@mingxy/opencode-mascot 0.4.23 → 0.4.24
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
|
@@ -187,9 +187,12 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
|
|
|
187
187
|
|
|
188
188
|
return (
|
|
189
189
|
<box
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
position="absolute"
|
|
191
|
+
left={posX()}
|
|
192
|
+
top={posY()}
|
|
193
|
+
alignItems="center"
|
|
194
|
+
zIndex={zBoost() ? 9999 : 100}
|
|
195
|
+
flexDirection="column"
|
|
193
196
|
ref={(node: any) => {
|
|
194
197
|
if (node) {
|
|
195
198
|
setContainerWidth(node.width || 0);
|
|
@@ -200,54 +203,45 @@ export function SidebarMascot(props: SidebarMascotProps): JSX.Element {
|
|
|
200
203
|
}
|
|
201
204
|
}
|
|
202
205
|
}}
|
|
206
|
+
onMouseDown={(e: any) => {
|
|
207
|
+
if (hideSide) { returnToView(); return; }
|
|
208
|
+
|
|
209
|
+
const now = Date.now();
|
|
210
|
+
if (now - lastClickTime < 300) {
|
|
211
|
+
switchToNext();
|
|
212
|
+
lastClickTime = 0;
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
lastClickTime = now;
|
|
216
|
+
|
|
217
|
+
if (e.modifiers?.alt) {
|
|
218
|
+
dragStartX = e.x;
|
|
219
|
+
dragStartY = e.y;
|
|
220
|
+
dragAnchorX = posX();
|
|
221
|
+
dragAnchorY = posY();
|
|
222
|
+
isDragging = true;
|
|
223
|
+
renderers[currentName()].setDragging(true);
|
|
224
|
+
props.api.renderer.clearSelection();
|
|
225
|
+
}
|
|
226
|
+
}}
|
|
227
|
+
onMouseDrag={(e: any) => {
|
|
228
|
+
if (e.modifiers?.alt && isDragging) {
|
|
229
|
+
setPosX(clampX(dragAnchorX + (e.x - dragStartX)));
|
|
230
|
+
setPosY(clampY(dragAnchorY + (e.y - dragStartY)));
|
|
231
|
+
}
|
|
232
|
+
}}
|
|
233
|
+
onMouseUp={() => {
|
|
234
|
+
isDragging = false;
|
|
235
|
+
renderers[currentName()].setDragging(false);
|
|
236
|
+
checkEdge();
|
|
237
|
+
}}
|
|
238
|
+
onMouseDragEnd={() => {
|
|
239
|
+
isDragging = false;
|
|
240
|
+
renderers[currentName()].setDragging(false);
|
|
241
|
+
checkEdge();
|
|
242
|
+
}}
|
|
203
243
|
>
|
|
204
|
-
|
|
205
|
-
position="absolute"
|
|
206
|
-
left={posX()}
|
|
207
|
-
top={posY()}
|
|
208
|
-
alignItems="center"
|
|
209
|
-
zIndex={zBoost() ? 9999 : 100}
|
|
210
|
-
flexDirection="column"
|
|
211
|
-
onMouseDown={(e: any) => {
|
|
212
|
-
if (hideSide) { returnToView(); return; }
|
|
213
|
-
|
|
214
|
-
const now = Date.now();
|
|
215
|
-
if (now - lastClickTime < 300) {
|
|
216
|
-
switchToNext();
|
|
217
|
-
lastClickTime = 0;
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
lastClickTime = now;
|
|
221
|
-
|
|
222
|
-
if (e.modifiers?.alt) {
|
|
223
|
-
dragStartX = e.x;
|
|
224
|
-
dragStartY = e.y;
|
|
225
|
-
dragAnchorX = posX();
|
|
226
|
-
dragAnchorY = posY();
|
|
227
|
-
isDragging = true;
|
|
228
|
-
renderers[currentName()].setDragging(true);
|
|
229
|
-
props.api.renderer.clearSelection();
|
|
230
|
-
}
|
|
231
|
-
}}
|
|
232
|
-
onMouseDrag={(e: any) => {
|
|
233
|
-
if (e.modifiers?.alt && isDragging) {
|
|
234
|
-
setPosX(clampX(dragAnchorX + (e.x - dragStartX)));
|
|
235
|
-
setPosY(clampY(dragAnchorY + (e.y - dragStartY)));
|
|
236
|
-
}
|
|
237
|
-
}}
|
|
238
|
-
onMouseUp={() => {
|
|
239
|
-
isDragging = false;
|
|
240
|
-
renderers[currentName()].setDragging(false);
|
|
241
|
-
checkEdge();
|
|
242
|
-
}}
|
|
243
|
-
onMouseDragEnd={() => {
|
|
244
|
-
isDragging = false;
|
|
245
|
-
renderers[currentName()].setDragging(false);
|
|
246
|
-
checkEdge();
|
|
247
|
-
}}
|
|
248
|
-
>
|
|
249
|
-
{renderers[currentName()]?.element() ?? null}
|
|
250
|
-
</box>
|
|
244
|
+
{renderers[currentName()]?.element() ?? null}
|
|
251
245
|
</box>
|
|
252
246
|
);
|
|
253
247
|
}
|