Pointer events

This commit is contained in:
Greg Shuflin 2023-10-03 02:43:27 -07:00
parent b429cf58f9
commit b2d2102779

View File

@ -12,6 +12,17 @@ const stage = new Konva.Stage({
}); });
const layer = new Konva.Layer(); const layer = new Konva.Layer();
stage.on("contextmenu", (e) => {
e.evt.preventDefault();
});
stage.on("pointerdown", (e) => {
const pos = stage.getPointerPosition();
console.log("position", pos);
console.log("event", e.evt, e.evt.button);
});
const circle = new Konva.Circle({ const circle = new Konva.Circle({
x: stage.width() /2, x: stage.width() /2,
y: stage.height() / 2, y: stage.height() / 2,