@linxin666/dsh-pet 0.4.7 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +1 -0
- package/README.zh.md +1 -0
- package/lib/client.js +121 -56
- package/lib/client.js.map +1 -1
- package/lib/types/client/PetSprite.d.ts +6 -4
- package/lib/types/client/PetSprite.d.ts.map +1 -1
- package/lib/types/client/PetSprite.js +100 -50
- package/lib/types/client/sequences.d.ts +9 -2
- package/lib/types/client/sequences.d.ts.map +1 -1
- package/lib/types/client/sequences.js +25 -14
- package/lib/types/client/spritesheet.d.ts +22 -1
- package/lib/types/client/spritesheet.d.ts.map +1 -1
- package/lib/types/client/spritesheet.js +26 -2
- package/package.json +1 -1
- package/src/client/PetSprite.test.tsx +262 -26
- package/src/client/PetSprite.tsx +99 -50
- package/src/client/pet-css.test.ts +12 -0
- package/src/client/pet.module.css +9 -3
- package/src/client/sequences.test.ts +37 -1
- package/src/client/sequences.ts +42 -16
- package/src/client/spritesheet.test.ts +81 -0
- package/src/client/spritesheet.ts +27 -2
- package/src/registry.test.ts +2 -1
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 24fafbceed13d042a8f42c01637a7c879008b9de
|
|
6
|
+
README.zh.md: eb5838637ea1f065ae1a2517f2dedc0afa0005db
|
package/README.md
CHANGED
|
@@ -246,6 +246,7 @@ Settings > Pet > Status bubbles (`auto` by default, `off` to silence the pet). `
|
|
|
246
246
|
| Registry id | Selector label | Source |
|
|
247
247
|
|---|---|---|
|
|
248
248
|
| `blue-throated-bee-eater` | 蓝喉蜂虎 | Companion art contributed by the repository contributor under Apache-2.0 (12 AI-illustrated pose references in the palette of the blue-throated-bee-eater skin; composed by docs/archive/blue-throated-bee-eater-pet/gen-pet.py with per-track standalone poses: perched, flight, front hover, waving, landing, droop, tilt, review; ship 小蜜蜂 as the treat name) |
|
|
249
|
+
| `deep-chan` | deep酱 | Sprite2d pixel-art pet contributed by Daizhdd: an 8-column x 9-row atlas of 256x288 cells (2048x2592, 57 frames) — 49 of them drawn as standalone per-frame artwork, the 8-frame walk cycle and the 5-frame jump each an independent pose, the remaining states varying by expression and small motion — plus the 8 running-left frames mirrored horizontally from running-right. deep酱 is an unofficial, fan-made derivative of the DeepSeek whale girl (鲸鱼娘): the character and all related rights belong to DeepSeek, this is fan artwork with no affiliation to or endorsement by DeepSeek, and the assets are personal non-commercial use only (see THIRD_PARTY_NOTICES.md). Repository-only, not published with the npm package |
|
|
249
250
|
| `doro` | doro | Frames2d gameplay pet (contributed by stushansusu under MIT): 11 tracks / 802 frames of 42 ms webp sequences — breathing idle, a work trio, sleep, a wash mode (mood +3/s), a four-direction crawl used by random roaming, three idle-director acts (cola / orange / tongue) and a drag-only struggle loop. Doro is an unofficial, fan-made derivative of Dorothy from *Goddess of Victory: Nikke*; the character and all related rights belong to SHIFT UP — personal non-commercial use only, unofficial and not affiliated with SHIFT UP (see THIRD_PARTY_NOTICES.md) |
|
|
250
251
|
| `jyn` | 女仆鲸鱼娘 | Frames2d gameplay pet (contributed by stushansusu under MIT): maid-whale desktop pet with work/sleep/touch gameplay and three selectable skins (暗夜鎏金 / 蓝海霓裳 / 冰晶公主), each with a probability-rolled click action; 暗夜鎏金 also swaps its own rest loop into the sleep gameplay |
|
|
251
252
|
| `jyn-foxtail` | 鲸鱼娘·狗尾巴草 | Frames2d gameplay pet (contributed by stushansusu under MIT): papercut whale-girl with thirteen 3.00 s frame tracks (idle, tease, eat, heart, face, work, work-success, work-fail, sleep, sleeping, snack, sneeze, yawn) carrying click, work, sleep and idle-director gameplay, plus one static webp cover per track under previews/ |
|
package/README.zh.md
CHANGED
|
@@ -246,6 +246,7 @@ ctx.effect(() => ctx.pet.registerPanelAction({
|
|
|
246
246
|
| 注册表 id | 选择器名称 | 来源 |
|
|
247
247
|
|---|---|---|
|
|
248
248
|
| `blue-throated-bee-eater` | 蓝喉蜂虎 | 贡献者以 Apache-2.0 贡献的伙伴插画(12 张同角色 AI 立绘素材,配色取蓝喉蜂虎皮肤同源;由 docs/archive/blue-throated-bee-eater-pet/gen-pet.py 组装,各轨道独立姿态:栖枝/飞行/正面悬停/挥翅/降落/垂头/歪头/昂首;饲料以「小蜜蜂」命名) |
|
|
249
|
+
| `deep-chan` | deep酱 | 由 Daizhdd 贡献的 sprite2d 像素风宠物:8 列 × 9 行、格 256×288 的图集(2048×2592,共 57 帧)——其中 49 帧为逐帧绘制的独立姿势,行走 8 帧是完整步态循环、跳跃 5 帧是独立姿势,其余状态由表情与小幅动作连续变化——另有 8 帧左走由右走水平镜像而来。deep酱 是「鲸鱼娘」的非官方同人二创形象:角色及相关权利归 DeepSeek 所有,与官方无隶属或背书关系,素材仅限个人非商业使用(见 THIRD_PARTY_NOTICES.md)。只放仓库、不随 npm 包发布 |
|
|
249
250
|
| `doro` | doro | 由 stushansusu 以 MIT 许可证贡献的 frames2d 玩法宠物:11 条轨道 / 802 帧 42ms webp 序列——呼吸待机、打工三件套、睡觉、洗澡模式(心情 +3/秒)、随机漫游用的四向爬行、三个待机小动作(cola / orange / tongue)与仅拖拽期间播放的挣扎循环。Doro 是《胜利女神:妮姬》桃乐丝的非官方同人二创/梗衍生形象,角色及相关权利归 SHIFT UP 所有——仅限个人非商业使用,与官方无隶属或背书关系(见 THIRD_PARTY_NOTICES.md)。 |
|
|
250
251
|
| `jyn` | 女仆鲸鱼娘 | frames2d 玩法宠物(stushansusu 以 MIT 贡献):带打工/睡觉/触摸玩法与三款可选皮肤(暗夜鎏金 / 蓝海霓裳 / 冰晶公主)的女仆鲸鱼同桌宠,每款皮肤各带一个概率掷骰点击动作;暗夜鎏金另将专属休息循环换入睡觉玩法 |
|
|
251
252
|
| `jyn-foxtail` | 鲸鱼娘·狗尾巴草 | 由 stushansusu 以 MIT 贡献的 frames2d 玩法宠物:剪纸风格的鲸鱼娘,13 条 3.00s 帧序列轨道(idle / tease / eat / heart / face / work / work-success / work-fail / sleep / sleeping / snack / sneeze / yawn),带点击、打工、睡觉与四个待机小动作玩法;previews/ 下每条轨道一张静态 webp 封面 |
|
package/lib/client.js
CHANGED
|
@@ -213,16 +213,40 @@ window.__ModuleLoader__.load({
|
|
|
213
213
|
return rowOf(animation);
|
|
214
214
|
}
|
|
215
215
|
/**
|
|
216
|
+
* Integer size of one cell after `scale`, in device-independent px.
|
|
217
|
+
*
|
|
218
|
+
* Rounding happens here, once, so the rendered atlas grid is integral end to
|
|
219
|
+
* end (issue #17): `background-size` is this size times the column/row count
|
|
220
|
+
* and every frame offset is an exact multiple of it. A fractional cell size
|
|
221
|
+
* leaves each frame on a sub-pixel boundary — 192px cells at `display.size`
|
|
222
|
+
* 160 scale to 147.69px — and the compositor then has to resample the whole
|
|
223
|
+
* scaled atlas on every frame change instead of translating an already-scaled
|
|
224
|
+
* bitmap by whole pixels. The pet advances a frame every 300-700 ms, so that
|
|
225
|
+
* resample was running continuously for a background surface the size of the
|
|
226
|
+
* sprite. A floor of 1px keeps a legally tiny display.size from collapsing the
|
|
227
|
+
* cell to zero and rendering nothing.
|
|
228
|
+
*/
|
|
229
|
+
function scaledCellSize(cell, scale) {
|
|
230
|
+
return {
|
|
231
|
+
width: Math.max(1, Math.round(cell.width * scale)),
|
|
232
|
+
height: Math.max(1, Math.round(cell.height * scale))
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
216
236
|
* Background-position (px) of one frame cell within the scaled atlas.
|
|
217
237
|
* The background image is scaled by `scale` (element size ÷ cell size), and
|
|
218
238
|
* background-position offsets are applied in SCALED coordinates — using raw
|
|
219
239
|
* atlas coordinates here would drift each frame by the scale factor and
|
|
220
|
-
* render torn/overlapping frames.
|
|
240
|
+
* render torn/overlapping frames. The scaled cell is quantized by
|
|
241
|
+
* {@link scaledCellSize}, so the offset of frame N is exactly N whole cells:
|
|
242
|
+
* the atlas is snapped to the pixel grid and a frame change is a plain
|
|
243
|
+
* translate of the scaled bitmap.
|
|
221
244
|
*/
|
|
222
245
|
function framePosition(cell, row, col, scale = 1) {
|
|
246
|
+
const scaled = scaledCellSize(cell, scale);
|
|
223
247
|
return {
|
|
224
|
-
x: -col *
|
|
225
|
-
y: -row *
|
|
248
|
+
x: -col * scaled.width,
|
|
249
|
+
y: -row * scaled.height
|
|
226
250
|
};
|
|
227
251
|
}
|
|
228
252
|
/**
|
|
@@ -246,8 +270,8 @@ window.__ModuleLoader__.load({
|
|
|
246
270
|
function createSequenceTimeline(sequence, tracks) {
|
|
247
271
|
const itemDurations = sequence.map((animation) => tracks[animation].durations.reduce((sum, value) => sum + value, 0));
|
|
248
272
|
const sequenceDuration = itemDurations.reduce((sum, value) => sum + value, 0);
|
|
249
|
-
|
|
250
|
-
let offset = Math.max(0, elapsedMs) % sequenceDuration;
|
|
273
|
+
const locate = (elapsedMs) => {
|
|
274
|
+
let offset = sequenceDuration > 0 ? Math.max(0, elapsedMs) % sequenceDuration : 0;
|
|
251
275
|
let itemIndex = 0;
|
|
252
276
|
while (itemIndex < sequence.length - 1 && offset >= itemDurations[itemIndex]) {
|
|
253
277
|
offset -= itemDurations[itemIndex];
|
|
@@ -262,13 +286,28 @@ window.__ModuleLoader__.load({
|
|
|
262
286
|
}
|
|
263
287
|
return {
|
|
264
288
|
animation,
|
|
265
|
-
|
|
289
|
+
track,
|
|
290
|
+
frameIndex,
|
|
291
|
+
offsetInFrame: offset
|
|
266
292
|
};
|
|
267
|
-
}
|
|
293
|
+
};
|
|
294
|
+
return {
|
|
295
|
+
frameAt(elapsedMs) {
|
|
296
|
+
const point = locate(elapsedMs);
|
|
297
|
+
return {
|
|
298
|
+
animation: point.animation,
|
|
299
|
+
frameIndex: point.frameIndex
|
|
300
|
+
};
|
|
301
|
+
},
|
|
302
|
+
remainingAt(elapsedMs) {
|
|
303
|
+
const point = locate(elapsedMs);
|
|
304
|
+
return Math.max(1, (point.track.durations[point.frameIndex] ?? 0) - point.offsetInFrame);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
268
307
|
}
|
|
269
308
|
//#endregion
|
|
270
309
|
//#region \0dsh-css:src/client/pet.module.css.mjs
|
|
271
|
-
const css$2 = ".v78Lda_float{pointer-events:auto;-webkit-user-select:none;user-select:none;will-change:transform;contain:layout style;flex-direction:column;align-items:center;display:flex;position:fixed}.v78Lda_sprite{image-rendering:auto;touch-action:none;contain:paint}.v78Lda_spriteWrap{flex:none;position:relative}.v78Lda_bubble{white-space:nowrap;padding:calc(4px * var(--pet-bubble-scale,1)) calc(10px * var(--pet-bubble-scale,1));font-size:calc(12px * var(--pet-bubble-scale,1));color:#f4f7ff;pointer-events:none;border-radius:999px;margin-bottom:6px;line-height:1.4;animation:2.6s ease-out forwards v78Lda_pet-bubble-pop;position:absolute;bottom:100%;box-shadow:0 2px 8px #00000040}.v78Lda_bubblePet{background:#4d6bfef2}.v78Lda_bubbleFeed{background:#0369a1f2}.v78Lda_bubbleStatus{max-width:min(calc(280px * var(--pet-bubble-scale,1)), calc(100vw - 24px));text-overflow:ellipsis;padding:calc(5px * var(--pet-bubble-scale,1)) calc(12px * var(--pet-bubble-scale,1));backdrop-filter:blur(8px);letter-spacing:.02em;background:linear-gradient(160deg,#131c36e6,#070b1af0);border:1px solid #7e98ff73;animation:.24s ease-out v78Lda_pet-bubble-in;overflow:hidden;box-shadow:0 4px 12px #02061759,inset 0 1px #e2e8ff1a,0 0 12px #4d6bfe2e}.v78Lda_bubbleWhisper{letter-spacing:.03em;animation:.32s cubic-bezier(.22,1,.36,1) v78Lda_pet-whisper-in}.v78Lda_bubbleWhisper:before{content:\"「\";opacity:.7;margin-right:2px}.v78Lda_bubbleWhisper:after{content:\"」\";opacity:.7;margin-left:2px}.v78Lda_bubbleStack{pointer-events:auto;flex-direction:column-reverse;align-items:center;gap:4px;display:flex;position:absolute;bottom:100%}.v78Lda_bubbleAnchor{display:inline-flex;position:relative}.v78Lda_bubbleMore{z-index:1;color:#eef2ff;cursor:pointer;background:linear-gradient(160deg,#4a68f5f2,#2f44b8f2);border:1px solid #7e98ff8c;border-radius:999px;justify-content:center;align-items:center;min-width:18px;height:18px;padding:0 5px;font-size:10px;font-weight:600;line-height:1;transition:filter .12s;display:inline-flex;position:absolute;top:-9px;right:-10px;box-shadow:0 2px 6px #02061766}.v78Lda_bubbleMore:hover{filter:brightness(1.15)}.v78Lda_bubbleMore:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}.v78Lda_bubbleStack .v78Lda_bubble{pointer-events:auto;margin-bottom:0;position:relative;bottom:auto}.v78Lda_bubbleClickable{cursor:pointer;font:inherit;text-align:center;appearance:none;transition:filter .12s,box-shadow .12s}.v78Lda_bubbleClickable:hover{filter:brightness(1.12)}.v78Lda_bubbleClickable:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}@keyframes v78Lda_pet-bubble-in{0%{opacity:0;transform:translateY(6px)scale(.96)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes v78Lda_pet-whisper-in{0%{opacity:0;transform:translateY(8px)scale(.9)}60%{transform:translateY(-1px)scale(1.02)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes v78Lda_pet-panel-in{0%{opacity:0;transform:translateY(4px)scale(.97)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes v78Lda_pet-bubble-pop{0%{opacity:0;transform:translateY(6px)scale(.85)}15%{opacity:1;transform:translateY(0)scale(1.05)}25%{transform:translateY(0)scale(1)}75%{opacity:1}to{opacity:0;transform:translateY(-8px)scale(.95)}}.v78Lda_panel{color:#e6ebf8;backdrop-filter:blur(10px);transform-origin:50% 0;background:linear-gradient(165deg,#131c36f2,#070b1af7);border:1px solid #7e98ff4d;border-radius:12px;flex-direction:column;gap:7px;min-width:148px;margin-top:8px;padding:10px 12px;font-size:12px;animation:.2s cubic-bezier(.22,1,.36,1) v78Lda_pet-panel-in;display:flex;position:absolute;top:100%;box-shadow:0 8px 24px #02061773,0 0 0 1px #4d6bfe1a,inset 0 1px #e2e8ff14}.v78Lda_panel:after{content:\"\";height:14px;position:absolute;bottom:100%;left:0;right:0}.v78Lda_panelAbove{transform-origin:50% 100%;margin-top:0;margin-bottom:8px;top:auto;bottom:100%}.v78Lda_panelAbove:after{top:100%;bottom:auto}.v78Lda_rankRow{white-space:nowrap;justify-content:space-between;gap:10px;display:flex}.v78Lda_nameCell{letter-spacing:.02em;background:linear-gradient(90deg,#a9c1ff,#6c8bff 60%,#4d6bfe);color:#0000;-webkit-background-clip:text;background-clip:text;font-weight:600}.v78Lda_statRank{color:#9db4ff;font-weight:600}.v78Lda_statTreats{color:#7dd3fc;font-weight:600}.v78Lda_statPoints{color:#fcd34d;font-weight:600}.v78Lda_renameRow{align-items:center;gap:6px;display:flex}.v78Lda_nameInput{color:#e6ebf8;background:#131c36e6;border:1px solid #7e98ff80;border-radius:6px;outline:none;flex:1;min-width:0;padding:3px 6px;font-size:12px}.v78Lda_nameInput:focus{border-color:#4d6bfe;box-shadow:0 0 0 2px #4d6bfe73}.v78Lda_actions{gap:6px;display:flex}.v78Lda_action{cursor:pointer;color:#fff;background:linear-gradient(#4a68f5,#3a55e0);border:none;border-radius:6px;flex:1;padding:4px 8px;font-size:12px;font-weight:600;transition:filter .12s,box-shadow .12s,transform .12s;box-shadow:0 2px 6px #4d6bfe4d}.v78Lda_action:hover{filter:brightness(1.08);transform:translateY(-1px);box-shadow:0 4px 10px #4d6bfe66}.v78Lda_action:active{filter:brightness(.94);transform:translateY(0);box-shadow:0 1px 4px #4d6bfe4d}.v78Lda_action:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}.v78Lda_summon{color:#8ea6ff;cursor:pointer;background:#070b1abf;border:1px dashed #7e98ff99;border-radius:999px;padding:2px 10px;font-size:11px;transition:border-color .12s,color .12s,background .12s,box-shadow .12s}.v78Lda_summon:hover{color:#c3d3ff;background:#070b1ae6;border-color:#7e98fff2}.v78Lda_summon:active{color:#8ea6ff;border-color:#7e98ffcc}.v78Lda_summon:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}@media (prefers-reduced-motion:reduce){.v78Lda_bubble,.v78Lda_bubbleStatus,.v78Lda_bubbleWhisper,.v78Lda_panel{opacity:1;animation:none}.v78Lda_action,.v78Lda_summon,.v78Lda_bubbleMore{transition:none}}.v78Lda_gameplayHud{width:0;height:0;position:absolute;bottom:0;left:0}.v78Lda_gameplayModeChip{color:#cdd7ff;white-space:nowrap;pointer-events:none;background:#7e98ff2e;border-radius:999px;padding:1px 8px;font-size:10px;position:absolute;top:0;left:0;transform:translateY(-100%)translateY(-4px)}.v78Lda_gameplayCard{color:#dfe6ff;background:#070b1aeb;border:1px solid #7e98ff40;border-radius:10px;min-width:180px;max-height:340px;padding:10px 12px;font-size:12px;position:absolute;bottom:0;left:0;overflow-y:auto;transform:none;box-shadow:0 8px 24px #0006}.v78Lda_gameplayBars{flex-direction:column;gap:4px;margin-bottom:8px;display:flex}.v78Lda_gameplayBarRow{align-items:center;gap:6px;display:flex}.v78Lda_gameplayBarLabel{color:#9aa8d8;flex-shrink:0;width:34px}.v78Lda_gameplayBarTrack{background:#7e98ff26;border-radius:3px;flex:1;height:6px;overflow:hidden}.v78Lda_gameplayBarFill{background:linear-gradient(90deg,#7e98ff,#9db4ff);border-radius:3px;height:100%;transition:width .3s;display:block}.v78Lda_gameplayActions{flex-wrap:wrap;gap:6px;display:flex}.v78Lda_gameplayShopItems{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:8px;display:grid}.v78Lda_gameplayShopItem{color:inherit;cursor:pointer;background:#7e98ff14;border:1px solid #7e98ff40;border-radius:8px;flex-direction:column;align-items:center;gap:4px;padding:8px 6px;display:flex}.v78Lda_gameplayShopItem:hover{background:#7e98ff29;border-color:#7e98ffb3}.v78Lda_gameplayShopItemImage{object-fit:contain;width:36px;height:36px;image-rendering:pixelated;pointer-events:none}.v78Lda_gameplayShopItemLabel{text-align:center;font-size:11px}.v78Lda_gameplayShopItemPrice{color:#ffd27e;font-size:10px}.v78Lda_gameplaySkinItems{flex-direction:column;gap:6px;margin-bottom:8px;display:flex}.v78Lda_gameplaySkinItem{width:100%;color:inherit;cursor:pointer;text-align:left;background:#7e98ff14;border:1px solid #7e98ff40;border-radius:8px;padding:8px 10px;font-size:12px;display:block}.v78Lda_gameplaySkinItem:hover{background:#7e98ff29;border-color:#7e98ffb3}.v78Lda_gameplaySkinItemActive{background:#7e98ff47;border-color:#7e98ffe6}.v78Lda_gameplayClose{color:#9aa8d8;cursor:pointer;background:0 0;border:none;padding:0 2px;font-size:14px;position:absolute;top:4px;right:8px}.v78Lda_gameplayClose:hover{color:#fff}.v78Lda_gameplayFloat{color:#3a2a00;white-space:nowrap;pointer-events:none;background:#ffd27eeb;border-radius:999px;padding:2px 10px;font-size:11px;animation:1.1s ease-out forwards v78Lda_pet-gameplay-float;position:absolute;top:-8px;left:50%;transform:translate(-50%)}@keyframes v78Lda_pet-gameplay-float{0%{opacity:0;transform:translate(-50%)translateY(6px)}20%{opacity:1}to{opacity:0;transform:translate(-50%)translateY(-18px)}}@media (prefers-reduced-motion:reduce){.v78Lda_gameplayFloat{opacity:1;animation:none}.v78Lda_gameplayBarFill{transition:none}}.v78Lda_bubbleUsage{white-space:nowrap;backdrop-filter:blur(8px);letter-spacing:.02em;background:linear-gradient(160deg,#131c36eb,#070b1af2);border:1px solid #7e98ff73;flex-direction:column;align-items:stretch;gap:3px;min-width:128px;max-width:min(280px,100vw - 24px);padding:6px 12px;animation:.28s cubic-bezier(.22,1,.36,1) v78Lda_pet-usage-in;display:flex;box-shadow:0 4px 12px #02061759,inset 0 1px #e2e8ff1a,0 0 12px #4d6bfe2e}.v78Lda_bubbleUsageHead{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.v78Lda_bubbleUsageTitle{text-overflow:ellipsis;opacity:.85;overflow:hidden}.v78Lda_bubbleUsageValue{font-variant-numeric:tabular-nums;flex-shrink:0;font-weight:600}.v78Lda_bubbleUsageNote{text-overflow:ellipsis;opacity:.55;font-size:10px;overflow:hidden}.v78Lda_bubbleUsageMeter{background:#e2e8ff24;border-radius:999px;height:4px;display:block;overflow:hidden}.v78Lda_bubbleUsageMeterFill{background:#6ee7b7;border-radius:999px;height:100%;transition:width .3s;display:block}.v78Lda_bubbleUsageOk{border-color:#7e98ff73}.v78Lda_bubbleUsageWarn{border-color:#fbbf248c}.v78Lda_bubbleUsageWarn .v78Lda_bubbleUsageMeterFill{background:#fbbf24}.v78Lda_bubbleUsageLow{border-color:#f8717199}.v78Lda_bubbleUsageLow .v78Lda_bubbleUsageMeterFill{background:#f87171}@keyframes v78Lda_pet-usage-in{0%{opacity:0;transform:translateY(6px)scale(.96)}to{opacity:1;transform:translateY(0)scale(1)}}@media (prefers-reduced-motion:reduce){.v78Lda_bubbleUsage{animation:none}}";
|
|
310
|
+
const css$2 = ".v78Lda_float{pointer-events:auto;-webkit-user-select:none;user-select:none;will-change:transform;contain:layout style;flex-direction:column;align-items:center;display:flex;position:fixed}.v78Lda_sprite{image-rendering:auto;touch-action:none;contain:paint}.v78Lda_spriteWrap{flex:none;position:relative}.v78Lda_bubble{white-space:nowrap;padding:calc(4px * var(--pet-bubble-scale,1)) calc(10px * var(--pet-bubble-scale,1));font-size:calc(12px * var(--pet-bubble-scale,1));color:#f4f7ff;pointer-events:none;border-radius:999px;margin-bottom:6px;line-height:1.4;animation:2.6s ease-out forwards v78Lda_pet-bubble-pop;position:absolute;bottom:100%;box-shadow:0 2px 8px #00000040}.v78Lda_bubblePet{background:#4d6bfef2}.v78Lda_bubbleFeed{background:#0369a1f2}.v78Lda_bubbleStatus{max-width:min(calc(280px * var(--pet-bubble-scale,1)), calc(100vw - 24px));text-overflow:ellipsis;padding:calc(5px * var(--pet-bubble-scale,1)) calc(12px * var(--pet-bubble-scale,1));letter-spacing:.02em;background:linear-gradient(160deg,#131c36e6,#070b1af0);border:1px solid #7e98ff73;animation:.24s ease-out v78Lda_pet-bubble-in;overflow:hidden;box-shadow:0 4px 12px #02061759,inset 0 1px #e2e8ff1a,0 0 12px #4d6bfe2e}.v78Lda_bubbleWhisper{letter-spacing:.03em;animation:.32s cubic-bezier(.22,1,.36,1) v78Lda_pet-whisper-in}.v78Lda_bubbleWhisper:before{content:\"「\";opacity:.7;margin-right:2px}.v78Lda_bubbleWhisper:after{content:\"」\";opacity:.7;margin-left:2px}.v78Lda_bubbleStack{pointer-events:auto;flex-direction:column-reverse;align-items:center;gap:4px;display:flex;position:absolute;bottom:100%}.v78Lda_bubbleAnchor{display:inline-flex;position:relative}.v78Lda_bubbleMore{z-index:1;color:#eef2ff;cursor:pointer;background:linear-gradient(160deg,#4a68f5f2,#2f44b8f2);border:1px solid #7e98ff8c;border-radius:999px;justify-content:center;align-items:center;min-width:18px;height:18px;padding:0 5px;font-size:10px;font-weight:600;line-height:1;transition:filter .12s;display:inline-flex;position:absolute;top:-9px;right:-10px;box-shadow:0 2px 6px #02061766}.v78Lda_bubbleMore:hover{filter:brightness(1.15)}.v78Lda_bubbleMore:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}.v78Lda_bubbleStack .v78Lda_bubble{pointer-events:auto;margin-bottom:0;position:relative;bottom:auto}.v78Lda_bubbleClickable{cursor:pointer;font:inherit;text-align:center;appearance:none;transition:filter .12s,box-shadow .12s}.v78Lda_bubbleClickable:hover{filter:brightness(1.12)}.v78Lda_bubbleClickable:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}@keyframes v78Lda_pet-bubble-in{0%{opacity:0;transform:translateY(6px)scale(.96)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes v78Lda_pet-whisper-in{0%{opacity:0;transform:translateY(8px)scale(.9)}60%{transform:translateY(-1px)scale(1.02)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes v78Lda_pet-panel-in{0%{opacity:0;transform:translateY(4px)scale(.97)}to{opacity:1;transform:translateY(0)scale(1)}}@keyframes v78Lda_pet-bubble-pop{0%{opacity:0;transform:translateY(6px)scale(.85)}15%{opacity:1;transform:translateY(0)scale(1.05)}25%{transform:translateY(0)scale(1)}75%{opacity:1}to{opacity:0;transform:translateY(-8px)scale(.95)}}.v78Lda_panel{color:#e6ebf8;transform-origin:50% 0;background:linear-gradient(165deg,#131c36f2,#070b1af7);border:1px solid #7e98ff4d;border-radius:12px;flex-direction:column;gap:7px;min-width:148px;margin-top:8px;padding:10px 12px;font-size:12px;animation:.2s cubic-bezier(.22,1,.36,1) v78Lda_pet-panel-in;display:flex;position:absolute;top:100%;box-shadow:0 8px 24px #02061773,0 0 0 1px #4d6bfe1a,inset 0 1px #e2e8ff14}.v78Lda_panel:after{content:\"\";height:14px;position:absolute;bottom:100%;left:0;right:0}.v78Lda_panelAbove{transform-origin:50% 100%;margin-top:0;margin-bottom:8px;top:auto;bottom:100%}.v78Lda_panelAbove:after{top:100%;bottom:auto}.v78Lda_rankRow{white-space:nowrap;justify-content:space-between;gap:10px;display:flex}.v78Lda_nameCell{letter-spacing:.02em;background:linear-gradient(90deg,#a9c1ff,#6c8bff 60%,#4d6bfe);color:#0000;-webkit-background-clip:text;background-clip:text;font-weight:600}.v78Lda_statRank{color:#9db4ff;font-weight:600}.v78Lda_statTreats{color:#7dd3fc;font-weight:600}.v78Lda_statPoints{color:#fcd34d;font-weight:600}.v78Lda_renameRow{align-items:center;gap:6px;display:flex}.v78Lda_nameInput{color:#e6ebf8;background:#131c36e6;border:1px solid #7e98ff80;border-radius:6px;outline:none;flex:1;min-width:0;padding:3px 6px;font-size:12px}.v78Lda_nameInput:focus{border-color:#4d6bfe;box-shadow:0 0 0 2px #4d6bfe73}.v78Lda_actions{gap:6px;display:flex}.v78Lda_action{cursor:pointer;color:#fff;background:linear-gradient(#4a68f5,#3a55e0);border:none;border-radius:6px;flex:1;padding:4px 8px;font-size:12px;font-weight:600;transition:filter .12s,box-shadow .12s,transform .12s;box-shadow:0 2px 6px #4d6bfe4d}.v78Lda_action:hover{filter:brightness(1.08);transform:translateY(-1px);box-shadow:0 4px 10px #4d6bfe66}.v78Lda_action:active{filter:brightness(.94);transform:translateY(0);box-shadow:0 1px 4px #4d6bfe4d}.v78Lda_action:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}.v78Lda_summon{color:#8ea6ff;cursor:pointer;background:#070b1abf;border:1px dashed #7e98ff99;border-radius:999px;padding:2px 10px;font-size:11px;transition:border-color .12s,color .12s,background .12s,box-shadow .12s}.v78Lda_summon:hover{color:#c3d3ff;background:#070b1ae6;border-color:#7e98fff2}.v78Lda_summon:active{color:#8ea6ff;border-color:#7e98ffcc}.v78Lda_summon:focus-visible{outline:none;box-shadow:0 0 0 2px #7e98ffe6}@media (prefers-reduced-motion:reduce){.v78Lda_bubble,.v78Lda_bubbleStatus,.v78Lda_bubbleWhisper,.v78Lda_panel{opacity:1;animation:none}.v78Lda_action,.v78Lda_summon,.v78Lda_bubbleMore{transition:none}}.v78Lda_gameplayHud{width:0;height:0;position:absolute;bottom:0;left:0}.v78Lda_gameplayModeChip{color:#cdd7ff;white-space:nowrap;pointer-events:none;background:#7e98ff2e;border-radius:999px;padding:1px 8px;font-size:10px;position:absolute;top:0;left:0;transform:translateY(-100%)translateY(-4px)}.v78Lda_gameplayCard{color:#dfe6ff;background:#070b1aeb;border:1px solid #7e98ff40;border-radius:10px;min-width:180px;max-height:340px;padding:10px 12px;font-size:12px;position:absolute;bottom:0;left:0;overflow-y:auto;transform:none;box-shadow:0 8px 24px #0006}.v78Lda_gameplayBars{flex-direction:column;gap:4px;margin-bottom:8px;display:flex}.v78Lda_gameplayBarRow{align-items:center;gap:6px;display:flex}.v78Lda_gameplayBarLabel{color:#9aa8d8;flex-shrink:0;width:34px}.v78Lda_gameplayBarTrack{background:#7e98ff26;border-radius:3px;flex:1;height:6px;overflow:hidden}.v78Lda_gameplayBarFill{background:linear-gradient(90deg,#7e98ff,#9db4ff);border-radius:3px;height:100%;transition:width .3s;display:block}.v78Lda_gameplayActions{flex-wrap:wrap;gap:6px;display:flex}.v78Lda_gameplayShopItems{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-bottom:8px;display:grid}.v78Lda_gameplayShopItem{color:inherit;cursor:pointer;background:#7e98ff14;border:1px solid #7e98ff40;border-radius:8px;flex-direction:column;align-items:center;gap:4px;padding:8px 6px;display:flex}.v78Lda_gameplayShopItem:hover{background:#7e98ff29;border-color:#7e98ffb3}.v78Lda_gameplayShopItemImage{object-fit:contain;width:36px;height:36px;image-rendering:pixelated;pointer-events:none}.v78Lda_gameplayShopItemLabel{text-align:center;font-size:11px}.v78Lda_gameplayShopItemPrice{color:#ffd27e;font-size:10px}.v78Lda_gameplaySkinItems{flex-direction:column;gap:6px;margin-bottom:8px;display:flex}.v78Lda_gameplaySkinItem{width:100%;color:inherit;cursor:pointer;text-align:left;background:#7e98ff14;border:1px solid #7e98ff40;border-radius:8px;padding:8px 10px;font-size:12px;display:block}.v78Lda_gameplaySkinItem:hover{background:#7e98ff29;border-color:#7e98ffb3}.v78Lda_gameplaySkinItemActive{background:#7e98ff47;border-color:#7e98ffe6}.v78Lda_gameplayClose{color:#9aa8d8;cursor:pointer;background:0 0;border:none;padding:0 2px;font-size:14px;position:absolute;top:4px;right:8px}.v78Lda_gameplayClose:hover{color:#fff}.v78Lda_gameplayFloat{color:#3a2a00;white-space:nowrap;pointer-events:none;background:#ffd27eeb;border-radius:999px;padding:2px 10px;font-size:11px;animation:1.1s ease-out forwards v78Lda_pet-gameplay-float;position:absolute;top:-8px;left:50%;transform:translate(-50%)}@keyframes v78Lda_pet-gameplay-float{0%{opacity:0;transform:translate(-50%)translateY(6px)}20%{opacity:1}to{opacity:0;transform:translate(-50%)translateY(-18px)}}@media (prefers-reduced-motion:reduce){.v78Lda_gameplayFloat{opacity:1;animation:none}.v78Lda_gameplayBarFill{transition:none}}.v78Lda_bubbleUsage{white-space:nowrap;letter-spacing:.02em;background:linear-gradient(160deg,#131c36eb,#070b1af2);border:1px solid #7e98ff73;flex-direction:column;align-items:stretch;gap:3px;min-width:128px;max-width:min(280px,100vw - 24px);padding:6px 12px;animation:.28s cubic-bezier(.22,1,.36,1) v78Lda_pet-usage-in;display:flex;box-shadow:0 4px 12px #02061759,inset 0 1px #e2e8ff1a,0 0 12px #4d6bfe2e}.v78Lda_bubbleUsageHead{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.v78Lda_bubbleUsageTitle{text-overflow:ellipsis;opacity:.85;overflow:hidden}.v78Lda_bubbleUsageValue{font-variant-numeric:tabular-nums;flex-shrink:0;font-weight:600}.v78Lda_bubbleUsageNote{text-overflow:ellipsis;opacity:.55;font-size:10px;overflow:hidden}.v78Lda_bubbleUsageMeter{background:#e2e8ff24;border-radius:999px;height:4px;display:block;overflow:hidden}.v78Lda_bubbleUsageMeterFill{background:#6ee7b7;border-radius:999px;height:100%;transition:width .3s;display:block}.v78Lda_bubbleUsageOk{border-color:#7e98ff73}.v78Lda_bubbleUsageWarn{border-color:#fbbf248c}.v78Lda_bubbleUsageWarn .v78Lda_bubbleUsageMeterFill{background:#fbbf24}.v78Lda_bubbleUsageLow{border-color:#f8717199}.v78Lda_bubbleUsageLow .v78Lda_bubbleUsageMeterFill{background:#f87171}@keyframes v78Lda_pet-usage-in{0%{opacity:0;transform:translateY(6px)scale(.96)}to{opacity:1;transform:translateY(0)scale(1)}}@media (prefers-reduced-motion:reduce){.v78Lda_bubbleUsage{animation:none}}";
|
|
272
311
|
const tagId$2 = "@linxin666/dsh-pet/src/client/pet.module.css";
|
|
273
312
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
|
|
274
313
|
const tag = document.createElement("style");
|
|
@@ -479,10 +518,12 @@ window.__ModuleLoader__.load({
|
|
|
479
518
|
});
|
|
480
519
|
}
|
|
481
520
|
/**
|
|
482
|
-
* The floating pet. The spritesheet frame advances on
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
*
|
|
521
|
+
* The floating pet. The spritesheet frame advances on a timer scheduled for the
|
|
522
|
+
* current frame's remaining time (per-frame durations come from the
|
|
523
|
+
* definition's tracks), so the loop wakes once per frame change instead of once
|
|
524
|
+
* per screen refresh; the atlas image is loaded once and the background
|
|
525
|
+
* position is written straight to the sprite element (no per-frame React
|
|
526
|
+
* state). Roaming writes the sprite's position the same way (issue #17).
|
|
486
527
|
*/
|
|
487
528
|
function PetSprite(props) {
|
|
488
529
|
const { snapshot, definition, display, feedback } = props;
|
|
@@ -566,6 +607,7 @@ window.__ModuleLoader__.load({
|
|
|
566
607
|
const animation = snapshot?.animation ?? "idle";
|
|
567
608
|
const scaleRef = (0, react.useRef)(spriteScale);
|
|
568
609
|
scaleRef.current = spriteScale;
|
|
610
|
+
const paintedRef = (0, react.useRef)(null);
|
|
569
611
|
(0, react.useEffect)(() => {
|
|
570
612
|
if (props.visual !== void 0) return;
|
|
571
613
|
const reduceMotion = typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches === true;
|
|
@@ -581,29 +623,37 @@ window.__ModuleLoader__.load({
|
|
|
581
623
|
const leadAnimation = sequence?.[0] ?? animation;
|
|
582
624
|
const row = rowOfTrack(leadAnimation);
|
|
583
625
|
const track = trimTrack(tracks[leadAnimation], rows[row] ?? tracks[leadAnimation].frames.length);
|
|
584
|
-
|
|
585
|
-
const
|
|
586
|
-
|
|
587
|
-
|
|
626
|
+
let lastPosStr = "";
|
|
627
|
+
const paint = (frameRow, col) => {
|
|
628
|
+
paintedRef.current = {
|
|
629
|
+
row: frameRow,
|
|
630
|
+
col
|
|
631
|
+
};
|
|
632
|
+
const pos = framePosition(cell, frameRow, col, scaleRef.current);
|
|
633
|
+
const posStr = pos.x + "px " + pos.y + "px";
|
|
634
|
+
if (posStr === lastPosStr) return;
|
|
635
|
+
lastPosStr = posStr;
|
|
636
|
+
if (spriteRef.current !== null) spriteRef.current.style.backgroundPosition = posStr;
|
|
637
|
+
};
|
|
638
|
+
paint(row, track.frames[0]);
|
|
588
639
|
if (reduceMotion) return;
|
|
589
|
-
let
|
|
640
|
+
let timer = 0;
|
|
590
641
|
let last = performance.now();
|
|
591
642
|
let sequenceElapsed = 0;
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
|
|
643
|
+
const schedule = (delay) => {
|
|
644
|
+
timer = window.setTimeout(tick, Math.max(1, delay));
|
|
645
|
+
};
|
|
646
|
+
const tick = () => {
|
|
647
|
+
timer = 0;
|
|
648
|
+
const now = performance.now();
|
|
649
|
+
const delta = now - last;
|
|
650
|
+
last = now;
|
|
595
651
|
if (timeline !== void 0 && sequenceItems !== void 0) {
|
|
596
652
|
sequenceElapsed += delta;
|
|
597
653
|
const current = timeline.frameAt(sequenceElapsed);
|
|
598
654
|
const item = sequenceItems.get(current.animation);
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
const posStr = pos.x + "px " + pos.y + "px";
|
|
602
|
-
if (posStr !== lastPosStr) {
|
|
603
|
-
lastPosStr = posStr;
|
|
604
|
-
if (spriteRef.current !== null) spriteRef.current.style.backgroundPosition = posStr;
|
|
605
|
-
}
|
|
606
|
-
raf = requestAnimationFrame(tick);
|
|
655
|
+
paint(item.row, item.track.frames[current.frameIndex]);
|
|
656
|
+
schedule(timeline.remainingAt(sequenceElapsed));
|
|
607
657
|
return;
|
|
608
658
|
}
|
|
609
659
|
const st = frameRef.current;
|
|
@@ -619,22 +669,19 @@ window.__ModuleLoader__.load({
|
|
|
619
669
|
st.index += 1;
|
|
620
670
|
}
|
|
621
671
|
if (st.elapsed >= (track.durations[st.index] ?? 0)) {
|
|
622
|
-
if (track.loop) {
|
|
623
|
-
st.
|
|
624
|
-
st.index
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
const posStr = pos.x + "px " + pos.y + "px";
|
|
630
|
-
if (posStr !== lastPosStr) {
|
|
631
|
-
lastPosStr = posStr;
|
|
632
|
-
if (spriteRef.current !== null) spriteRef.current.style.backgroundPosition = posStr;
|
|
672
|
+
if (!track.loop) {
|
|
673
|
+
st.index = maxIndex;
|
|
674
|
+
paint(row, track.frames[st.index]);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
st.elapsed = 0;
|
|
678
|
+
st.index = 0;
|
|
633
679
|
}
|
|
634
|
-
|
|
680
|
+
paint(row, track.frames[st.index]);
|
|
681
|
+
schedule((track.durations[st.index] ?? 0) - st.elapsed);
|
|
635
682
|
};
|
|
636
|
-
|
|
637
|
-
return () =>
|
|
683
|
+
schedule(0);
|
|
684
|
+
return () => window.clearTimeout(timer);
|
|
638
685
|
}, [
|
|
639
686
|
animation,
|
|
640
687
|
phase,
|
|
@@ -645,6 +692,16 @@ window.__ModuleLoader__.load({
|
|
|
645
692
|
sequences,
|
|
646
693
|
props.visual
|
|
647
694
|
]);
|
|
695
|
+
(0, react.useLayoutEffect)(() => {
|
|
696
|
+
const painted = paintedRef.current;
|
|
697
|
+
if (props.visual !== void 0 || painted === null || spriteRef.current === null) return;
|
|
698
|
+
const pos = framePosition(cell, painted.row, painted.col, spriteScale);
|
|
699
|
+
spriteRef.current.style.backgroundPosition = pos.x + "px " + pos.y + "px";
|
|
700
|
+
}, [
|
|
701
|
+
spriteScale,
|
|
702
|
+
cell,
|
|
703
|
+
props.visual
|
|
704
|
+
]);
|
|
648
705
|
const feedbackDoneRef = (0, react.useRef)(props.onFeedbackDone);
|
|
649
706
|
feedbackDoneRef.current = props.onFeedbackDone;
|
|
650
707
|
(0, react.useEffect)(() => {
|
|
@@ -662,13 +719,13 @@ window.__ModuleLoader__.load({
|
|
|
662
719
|
(0, react.useEffect)(() => () => clearHideTimer(), []);
|
|
663
720
|
const onPointerDown = (e) => {
|
|
664
721
|
if (props.dragDisabled === true) return;
|
|
665
|
-
|
|
666
|
-
e.preventDefault();
|
|
667
|
-
e.target.setPointerCapture?.(e.pointerId);
|
|
668
|
-
const current = dragPos ?? {
|
|
722
|
+
const current = walkTargetRef.current ?? dragPosRef.current ?? {
|
|
669
723
|
right: display.right,
|
|
670
724
|
bottom: display.bottom
|
|
671
725
|
};
|
|
726
|
+
endWalk(false);
|
|
727
|
+
e.preventDefault();
|
|
728
|
+
e.target.setPointerCapture?.(e.pointerId);
|
|
672
729
|
dragRef.current = {
|
|
673
730
|
startX: e.clientX,
|
|
674
731
|
startY: e.clientY,
|
|
@@ -699,17 +756,18 @@ window.__ModuleLoader__.load({
|
|
|
699
756
|
if (draggedRef.current) props.onDraggingChange?.(false);
|
|
700
757
|
if (dragPos !== null) props.onDragEnd(dragPos.right, dragPos.bottom);
|
|
701
758
|
};
|
|
702
|
-
const pos = dragPos ?? {
|
|
703
|
-
right: display.right,
|
|
704
|
-
bottom: display.bottom
|
|
705
|
-
};
|
|
706
|
-
const spriteWidth = Math.round(cell.width * spriteScale);
|
|
707
|
-
const spriteHeight = Math.round(cell.height * spriteScale);
|
|
708
759
|
const [facingRight, setFacingRight] = (0, react.useState)(false);
|
|
709
760
|
const walkRafRef = (0, react.useRef)(0);
|
|
710
761
|
const walkTargetRef = (0, react.useRef)(null);
|
|
711
762
|
const dragPosRef = (0, react.useRef)(dragPos);
|
|
712
763
|
dragPosRef.current = dragPos;
|
|
764
|
+
const pos = walkTargetRef.current ?? dragPos ?? {
|
|
765
|
+
right: display.right,
|
|
766
|
+
bottom: display.bottom
|
|
767
|
+
};
|
|
768
|
+
const scaled = scaledCellSize(cell, spriteScale);
|
|
769
|
+
const spriteWidth = scaled.width;
|
|
770
|
+
const spriteHeight = scaled.height;
|
|
713
771
|
/** Stop an active walk; `persist` lands the pet on the spot it reached. */
|
|
714
772
|
const endWalk = (persist) => {
|
|
715
773
|
if (walkRafRef.current === 0) return;
|
|
@@ -718,7 +776,9 @@ window.__ModuleLoader__.load({
|
|
|
718
776
|
setFacingRight(false);
|
|
719
777
|
const settled = walkTargetRef.current;
|
|
720
778
|
walkTargetRef.current = null;
|
|
721
|
-
if (
|
|
779
|
+
if (settled === null) return;
|
|
780
|
+
setDragPos(settled);
|
|
781
|
+
if (persist) props.onDragEnd(settled.right, settled.bottom);
|
|
722
782
|
};
|
|
723
783
|
(0, react.useEffect)(() => {
|
|
724
784
|
const bus = props.bus;
|
|
@@ -754,7 +814,11 @@ window.__ModuleLoader__.load({
|
|
|
754
814
|
bottom: current.bottom + (target.bottom - current.bottom) * t
|
|
755
815
|
};
|
|
756
816
|
walkTargetRef.current = next;
|
|
757
|
-
|
|
817
|
+
const el = floatRef.current;
|
|
818
|
+
if (el !== null) {
|
|
819
|
+
el.style.right = next.right + "px";
|
|
820
|
+
el.style.bottom = next.bottom + "px";
|
|
821
|
+
}
|
|
758
822
|
if (t < 1) {
|
|
759
823
|
walkRafRef.current = window.requestAnimationFrame(step);
|
|
760
824
|
return;
|
|
@@ -762,6 +826,7 @@ window.__ModuleLoader__.load({
|
|
|
762
826
|
walkRafRef.current = 0;
|
|
763
827
|
walkTargetRef.current = null;
|
|
764
828
|
setFacingRight(false);
|
|
829
|
+
setDragPos(next);
|
|
765
830
|
props.onDragEnd(next.right, next.bottom);
|
|
766
831
|
};
|
|
767
832
|
walkRafRef.current = window.requestAnimationFrame(step);
|
|
@@ -862,7 +927,7 @@ window.__ModuleLoader__.load({
|
|
|
862
927
|
height: spriteHeight,
|
|
863
928
|
...props.visual === void 0 ? {
|
|
864
929
|
backgroundImage: imageReady ? "url(" + definition.atlasUrl + ")" : void 0,
|
|
865
|
-
backgroundSize:
|
|
930
|
+
backgroundSize: scaled.width * columns + "px " + scaled.height * (definition.atlasRows ?? rows.length) + "px",
|
|
866
931
|
backgroundRepeat: "no-repeat",
|
|
867
932
|
backgroundPosition: "0 0"
|
|
868
933
|
} : {},
|
|
@@ -4236,7 +4301,7 @@ window.__ModuleLoader__.load({
|
|
|
4236
4301
|
/** The building package's version, when the bundle carries it. */
|
|
4237
4302
|
function bakedVersion() {
|
|
4238
4303
|
try {
|
|
4239
|
-
return "0.4.
|
|
4304
|
+
return "0.4.8";
|
|
4240
4305
|
} catch {
|
|
4241
4306
|
return;
|
|
4242
4307
|
}
|