@mingxy/opencode-mascot 0.4.0 → 0.4.2
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/package.json
CHANGED
|
@@ -54,47 +54,48 @@ export function HomeMascot(props: HomeMascotProps): JSX.Element {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<box
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
<box height={5} zIndex={9999}>
|
|
58
|
+
<box
|
|
59
|
+
position="absolute"
|
|
60
|
+
left={posX()}
|
|
61
|
+
top={posY()}
|
|
62
|
+
flexDirection="column"
|
|
63
|
+
onMouseDown={(e: any) => {
|
|
64
|
+
const now = Date.now();
|
|
65
|
+
if (now - lastClickTime < 300) {
|
|
66
|
+
switchToNext();
|
|
67
|
+
lastClickTime = 0;
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
lastClickTime = now;
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
72
|
+
if (e.modifiers?.alt) {
|
|
73
|
+
dragStartX = e.x;
|
|
74
|
+
dragStartY = e.y;
|
|
75
|
+
dragAnchorX = posX();
|
|
76
|
+
dragAnchorY = posY();
|
|
77
|
+
isDragging = true;
|
|
78
|
+
renderers[currentName()].setDragging(true);
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
e.stopPropagation();
|
|
81
|
+
props.api.renderer.clearSelection();
|
|
82
|
+
}
|
|
83
|
+
}}
|
|
84
|
+
onMouseDrag={(e: any) => {
|
|
85
|
+
if (e.modifiers?.alt && isDragging) {
|
|
86
|
+
setPosX(dragAnchorX + (e.x - dragStartX));
|
|
87
|
+
setPosY(dragAnchorY + (e.y - dragStartY));
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
e.stopPropagation();
|
|
90
|
+
props.api.renderer.clearSelection();
|
|
91
|
+
}
|
|
92
|
+
}}
|
|
93
|
+
onMouseUp={() => { stopDrag(); }}
|
|
94
|
+
onMouseDragEnd={() => { stopDrag(); }}
|
|
95
|
+
onMouseOut={() => { stopDrag(); }}
|
|
96
|
+
>
|
|
97
|
+
{renderers[currentName()]?.element() ?? null}
|
|
98
|
+
</box>
|
|
98
99
|
</box>
|
|
99
100
|
);
|
|
100
101
|
}
|
|
@@ -315,14 +315,12 @@ export function createAnimatedRenderer(pack: MascotPack): {
|
|
|
315
315
|
const dm = dragMsg();
|
|
316
316
|
|
|
317
317
|
return (
|
|
318
|
-
<box flexDirection="column"
|
|
319
|
-
{cel ? <text fg={flashColor() ?? fg}
|
|
320
|
-
{dm ? <text fg="#FF4081"
|
|
321
|
-
|
|
322
|
-
{
|
|
323
|
-
|
|
324
|
-
))}
|
|
325
|
-
</box>
|
|
318
|
+
<box flexDirection="column" left={left} top={top}>
|
|
319
|
+
{cel ? <text fg={flashColor() ?? fg}>{cel.text}</text> : null}
|
|
320
|
+
{dm ? <text fg="#FF4081">{dm}</text> : null}
|
|
321
|
+
{lines.map((line: string) => (
|
|
322
|
+
<text fg={flashColor() ?? fg}>{line}</text>
|
|
323
|
+
))}
|
|
326
324
|
</box>
|
|
327
325
|
);
|
|
328
326
|
};
|