mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 02:00:46 +00:00
drag and drop fix
This commit is contained in:
1 parent
b739e36a14
commit
cb6b3f1246
2 files changed
+31
-2
No files matched your search
@@ -18,7 +18,8 @@ import {
|
||||
sidePanelVisible,
|
||||
dndSidePanelWidth,
|
||||
dndTimelineHeight,
|
||||
sidePanelHeight,
|
||||
dragItem,
|
||||
canDrop,
|
||||
} from "~/pages/PageEnigma/store";
|
||||
import { useSignals } from "@preact/signals-react/runtime";
|
||||
import { AppUiContext } from "~/contexts/AppUiContext";
|
||||
@@ -26,6 +27,7 @@ import { pageHeight, pageWidth } from "~/store";
|
||||
import { TopBar } from "~/modules/TopBar";
|
||||
import { DialogueTTS } from "./comps/DialogueTTS/DialogueTTS";
|
||||
import { Pages } from "~/pages/PageEnigma/constants/page";
|
||||
import { AssetType } from "./models/assets";
|
||||
|
||||
interface Props {
|
||||
setPage: (page: Pages) => void;
|
||||
@@ -83,7 +85,29 @@ export const PageEditor = ({ setPage }: Props) => {
|
||||
84,
|
||||
height: pageHeight.value - timelineHeight.value - 68,
|
||||
}}>
|
||||
<canvas id="video-scene" width="1280px" height="720px" />
|
||||
<canvas
|
||||
id="video-scene"
|
||||
width="1280px"
|
||||
height="720px"
|
||||
onPointerOver={() => {
|
||||
if (
|
||||
dragItem.value?.type === AssetType.OBJECT ||
|
||||
dragItem.value?.type === AssetType.SHAPE ||
|
||||
dragItem.value?.type === AssetType.CHARACTER
|
||||
) {
|
||||
canDrop.value = true;
|
||||
}
|
||||
}}
|
||||
onPointerLeave={() => {
|
||||
if (
|
||||
dragItem.value?.type === AssetType.OBJECT ||
|
||||
dragItem.value?.type === AssetType.SHAPE ||
|
||||
dragItem.value?.type === AssetType.CHARACTER
|
||||
) {
|
||||
canDrop.value = false;
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Top controls */}
|
||||
|
||||
@@ -33,6 +33,11 @@ export const TrackProvider = ({ children }: Props) => {
|
||||
|
||||
// cross group functions
|
||||
const dropClip = useCallback(() => {
|
||||
if (!canDrop.value) {
|
||||
endDrag();
|
||||
return;
|
||||
}
|
||||
|
||||
if (dragItem.value) {
|
||||
const mediaItem = dragItem.value;
|
||||
if (mediaItem.type === AssetType.CHARACTER) {
|
||||
|
||||
Reference in new issue
Block a user