Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove right-click menu for backdrop #616

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading