Skip to content

Commit

Permalink
Remove right-click menu for backdrop (#616)
Browse files Browse the repository at this point in the history
fix #606
  • Loading branch information
ComfyFluffy authored Jun 28, 2024
1 parent 7f5e28b commit a5632e0
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { useEditorCtx } from '../../EditorContextProvider.vue'
import SpriteTransformer from './SpriteTransformer.vue'
import SpriteItem from './SpriteItem.vue'
import { MapMode } from '@/models/stage'
import Konva from 'konva'
const editorCtx = useEditorCtx()
const conatiner = ref<HTMLElement | null>(null)
Expand Down Expand Up @@ -158,6 +159,12 @@ const menuPos = ref({ x: 0, y: 0 })
function handleContextMenu(e: KonvaEventObject<MouseEvent>) {
e.evt.preventDefault()
// Ignore right click on backdrop.
// Konva.Rect is a subclass of Konva.Shape.
// Currently we have all sprites as Konva.Shape and backdrop as Konva.Rect.
if (e.target instanceof Konva.Rect) return
if (stageRef.value == null || e.target.parent == null) return
const stage: Stage = stageRef.value.getStage()
const pointerPos = stage.getPointerPosition()
Expand Down

0 comments on commit a5632e0

Please sign in to comment.