source: imaps-frontend/node_modules/konva/lib/PointerEvents.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.5 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.releaseCapture = exports.setPointerCapture = exports.hasPointerCapture = exports.createEvent = exports.getCapturedShape = void 0;
4const Global_1 = require("./Global");
5const Captures = new Map();
6const SUPPORT_POINTER_EVENTS = Global_1.Konva._global['PointerEvent'] !== undefined;
7function getCapturedShape(pointerId) {
8 return Captures.get(pointerId);
9}
10exports.getCapturedShape = getCapturedShape;
11function createEvent(evt) {
12 return {
13 evt,
14 pointerId: evt.pointerId,
15 };
16}
17exports.createEvent = createEvent;
18function hasPointerCapture(pointerId, shape) {
19 return Captures.get(pointerId) === shape;
20}
21exports.hasPointerCapture = hasPointerCapture;
22function setPointerCapture(pointerId, shape) {
23 releaseCapture(pointerId);
24 const stage = shape.getStage();
25 if (!stage)
26 return;
27 Captures.set(pointerId, shape);
28 if (SUPPORT_POINTER_EVENTS) {
29 shape._fire('gotpointercapture', createEvent(new PointerEvent('gotpointercapture')));
30 }
31}
32exports.setPointerCapture = setPointerCapture;
33function releaseCapture(pointerId, target) {
34 const shape = Captures.get(pointerId);
35 if (!shape)
36 return;
37 const stage = shape.getStage();
38 if (stage && stage.content) {
39 }
40 Captures.delete(pointerId);
41 if (SUPPORT_POINTER_EVENTS) {
42 shape._fire('lostpointercapture', createEvent(new PointerEvent('lostpointercapture')));
43 }
44}
45exports.releaseCapture = releaseCapture;
Note: See TracBrowser for help on using the repository browser.