mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 01:18:34 +00:00
PageScene: route PoseModeSelector through getActiveEditor()
The Enter Pose Mode button reached through a window.__mouseControls global handle that MouseControls' constructor set up. With getActiveEditor() already exposing the live editor instance for non-React callers (used in the camera-view toggle, the keymap), the global is unnecessary. Drop the (window as any).__mouseControls = this assignment in MouseControls and the matching Window augmentation in PoseModeSelector. Replace the click handler's reach with getActiveEditor()?.mouse_controls?.toggleFKMode() — same shape the keymap entry already uses.
This commit is contained in:
1 parent
794f65b517
commit
01e0e27037
2 files changed
+2
-13
No files matched your search
@@ -4,14 +4,7 @@ import { Tooltip } from "@storyteller/ui-tooltip";
|
||||
import { Button } from "@storyteller/ui-button";
|
||||
import { faCheck, faPersonRunning } from "@fortawesome/pro-solid-svg-icons";
|
||||
import { usePageSceneStore } from "../PageSceneStore";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__mouseControls?: {
|
||||
toggleFKMode: () => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
import { getActiveEditor } from "../contexts/EngineContext/EngineContext";
|
||||
|
||||
interface PoseModeSelectorProps {}
|
||||
|
||||
@@ -26,7 +19,7 @@ export const PoseModeSelector: React.FC<PoseModeSelectorProps> = () => {
|
||||
|
||||
const handleModeChange = () => {
|
||||
setPoseMode(poseMode === "select" ? "pose" : "select");
|
||||
window.__mouseControls?.toggleFKMode();
|
||||
getActiveEditor()?.mouse_controls?.toggleFKMode();
|
||||
};
|
||||
|
||||
if (!showPoseControls) {
|
||||
|
||||
@@ -152,10 +152,6 @@ export class MouseControls {
|
||||
scene: this.scene,
|
||||
onDragChange: this.onFKControlsDragging.bind(this),
|
||||
});
|
||||
|
||||
// Expose handlePoseModeChange to window
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(window as any).__mouseControls = this;
|
||||
}
|
||||
|
||||
onFKControlsDragging(dragging: boolean) {
|
||||
|
||||
Reference in new issue
Block a user