Add queue message when clicking to move currentTime

This commit is contained in:
FromTheLOLAshes committed 2024-03-30 13:07:45 +07:00
1 parent 221de747e0
commit 399b2652cb
2 files changed
+10 -4

No files matched your search

+10 -1
View File
@@ -6,6 +6,9 @@ import {
scale,
timelineHeight,
} from "~/pages/PageEnigma/store";
import Queue from "~/pages/PageEnigma/Queue/Queue";
import { QueueNames } from "~/pages/PageEnigma/Queue/QueueNames";
import { toEngineActions } from "~/pages/PageEnigma/Queue/toEngineActions";
interface LowerPanelPropsI {
children: React.ReactNode;
@@ -19,7 +22,13 @@ export const LowerPanel = ({ children }: LowerPanelPropsI) => {
const onTimelineClick = useCallback(
(event: React.PointerEvent<HTMLDivElement>) => {
if (event.button === 0) {
currentTime.value = (Math.round(event.clientX) - 92) / 4 / scale.value;
const newTime = Math.round((event.clientX - 92) / 4 / scale.value);
currentTime.value = newTime;
Queue.publish({
queueName: QueueNames.TO_ENGINE,
action: toEngineActions.UPDATE_TIME,
data: { currentTime: Math.round(newTime) },
});
}
},
[],
@@ -17,11 +17,8 @@ import {
timelineHeight,
} from "~/pages/PageEnigma/store";
import { useQueueHandler } from "~/pages/PageEnigma/comps/Timeline/utils/useQueueHandler";
import { EngineContext } from "../../contexts/EngineContext";
export const Timeline = () => {
const editorEngine = useContext(EngineContext);
const {
characters,
objects,