Skip to content

Commit cece029

Browse files
author
dazhi
committed
fix(minimax-pet): 展开卡片只增高不变宽,桌宠不再左右滑动
窗口以右下角为锚点,展开尺寸是 300×488 而紧凑是 280×340,于是窗口左边缘 左移 10px,居中的桌宠在屏幕上跟着平移,收起时再弹回去——用户看到的就是 点一下闪一下。展开宽度改为与紧凑一致的 280,只增高,桌宠屏幕坐标不变。 同时处理 #129 的两条评论: - package-lock.json 里 cssstyle 依赖的 rrweb-cssom 版本改回 0.8.0, 与 resolved/integrity 指向的包一致; - .desk 回退为 overflow: hidden,原先那行 overflow: visible 与注释 并不成立,因为 html.mode-window body 本身就是 overflow: hidden。
1 parent ee2243a commit cece029

7 files changed

Lines changed: 32 additions & 11 deletions

File tree

‎plugins/minimax-ai/minimax-pet/miniapp/client/pet-app.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,10 @@ let workbenchView = null;
255255
let workbenchWindow = null;
256256
const reminders = createReminderStore();
257257
// Expanded card: the pet keeps its slot at the bottom and the card gets a readable
258-
// reply body, instead of the ~110px left in the compact window.
259-
const compactBubbleSize = { width: 300, height: 520 };
258+
// reply body, instead of the ~110px left in the compact window. The width stays at the
259+
// compact 280 on purpose: growing wider moves the bottom-right anchored window left,
260+
// which slides the pet sideways on every open and reads as a flicker.
261+
const compactBubbleSize = { width: 280, height: 520 };
260262
let notificationPreviews = null;
261263
let askObserver = null;
262264
let detailOpenToken = 0;

‎plugins/minimax-ai/minimax-pet/miniapp/client/pet.css‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,7 @@ html.mode-window body {
619619
justify-content: flex-end;
620620
gap: 4px;
621621
padding: 8px 8px 4px;
622-
/* The window is transparent and frameless: the card may overflow it upward so a
623-
long reply keeps a readable body instead of a single line. */
624-
overflow: visible;
622+
overflow: hidden;
625623
}
626624

627625
.desk-overlays {

‎sources/minimax-ai/minimax-pet/DEVELOPMENT.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ npm run check:package
2828
- Preference and imported-resource writes are local to `context.dataDir`. Interrupted replacements retain enough information to restore or finish safely before the next read/write. Legacy ambiguous trash is retained for recovery.
2929
- Resizing the desktop pet first brings the transparent window inside the available screen area so smaller sprites remain reachable.
3030
- Click-through follows the pixels, never a whole mode: the same rule covers the pet, the bubble, the notification stack, the quick bar, the menu and the open card. An expanded card window is 300x488 around a 284x147 card, so treating "card open" as "window interactive" swallows every click in the margin. Only a drag or an open menu justify the whole window, and a card opened from the keyboard (no pointer sample yet) stays interactive.
31+
- Expanding the card must not change the window width. The window is anchored bottom-right, so a wider expanded size moves its left edge and slides the centred pet sideways on every open and close, which reads as a flicker. Only the height grows; `dev/workbench-window.test.mjs` fails if the declared card width ever differs from the compact 280.
3132
- Opening the card must not change the running sprite animation. Hover runs the `jumping` row; reverting to the base state on open restarts it at frame 0, which reads as a flicker on every click. The menu still takes the pet back to its base animation, because the menu is a deliberate choice.
3233
- Every user-visible string comes from `miniapp/client/i18n.mjs` through `t()`; static markup carries `data-i18n` / `data-i18n-attr`. Keys are `<domain>.<context>.<name>`, interpolation is `{{name}}`, a missing key renders as the key itself, and `dev/i18n.test.mjs` fails when a key the client uses is missing from either language. Conversation titles, replies and error text from the Host are data and stay in the language the Agent wrote them.
3334
- Text created once when a view is built (segmented labels, compact-view buttons) must be re-applied on a language change, or it keeps the language of the moment it was built.

‎sources/minimax-ai/minimax-pet/dev/workbench-window.test.mjs‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import assert from 'node:assert/strict';
2+
import { readFile } from 'node:fs/promises';
23
import test from 'node:test';
34
import { createWorkbenchWindow } from '../miniapp/client/workbench-window.mjs';
45

@@ -160,3 +161,22 @@ test('unavailable, inline and non-resizable handles fail without writing geometr
160161
assert.deepEqual(await fixed.controller.setExpanded(true), { ok: false, code: 'not_permitted' });
161162
assert.deepEqual(fixed.calls, []); assert.deepEqual(inline.calls, []);
162163
});
164+
165+
test('expanding the companion card never moves the pet sideways', async () => {
166+
// The pet is centred in the window, so a bottom-right anchored resize only keeps it
167+
// still if the width is unchanged. A wider card slides the pet and reads as a flicker
168+
// each time the card opens.
169+
const source = await readFile(new URL('../miniapp/client/pet-app.js', import.meta.url), 'utf8');
170+
const declared = source.match(/const compactBubbleSize = \{ width: (\d+), height: (\d+) \};/u);
171+
assert.ok(declared, 'compactBubbleSize is where the card size is declared');
172+
const expandedSize = { width: Number(declared[1]), height: Number(declared[2]) };
173+
const petWidth = 144;
174+
const petScreenX = (bounds) => bounds.x + (bounds.width - petWidth) / 2;
175+
const h = harness({ expandedSize, state: { mode: 'window', window: { x: 1640, y: 680, width: 280, height: 340, resizable: true } } });
176+
const before = petScreenX(h.state().window);
177+
await h.controller.setExpanded(true);
178+
assert.equal(petScreenX(h.state().window), before, 'opening the card must not move the pet');
179+
assert.ok(h.state().window.height > 340, 'the card still gets more room');
180+
await h.controller.setExpanded(false);
181+
assert.equal(petScreenX(h.state().window), before, 'closing it must not move the pet either');
182+
});

‎sources/minimax-ai/minimax-pet/miniapp/client/pet-app.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,10 @@ let workbenchView = null;
255255
let workbenchWindow = null;
256256
const reminders = createReminderStore();
257257
// Expanded card: the pet keeps its slot at the bottom and the card gets a readable
258-
// reply body, instead of the ~110px left in the compact window.
259-
const compactBubbleSize = { width: 300, height: 520 };
258+
// reply body, instead of the ~110px left in the compact window. The width stays at the
259+
// compact 280 on purpose: growing wider moves the bottom-right anchored window left,
260+
// which slides the pet sideways on every open and reads as a flicker.
261+
const compactBubbleSize = { width: 280, height: 520 };
260262
let notificationPreviews = null;
261263
let askObserver = null;
262264
let detailOpenToken = 0;

‎sources/minimax-ai/minimax-pet/miniapp/client/pet.css‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -619,9 +619,7 @@ html.mode-window body {
619619
justify-content: flex-end;
620620
gap: 4px;
621621
padding: 8px 8px 4px;
622-
/* The window is transparent and frameless: the card may overflow it upward so a
623-
long reply keeps a readable body instead of a single line. */
624-
overflow: visible;
622+
overflow: hidden;
625623
}
626624

627625
.desk-overlays {

‎sources/minimax-ai/minimax-pet/package-lock.json‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)