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

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[d565449]1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
[0c6b92a]3exports.getCapturedShape = getCapturedShape;
4exports.createEvent = createEvent;
5exports.hasPointerCapture = hasPointerCapture;
6exports.setPointerCapture = setPointerCapture;
7exports.releaseCapture = releaseCapture;
[d565449]8const Global_1 = require("./Global");
9const Captures = new Map();
10const SUPPORT_POINTER_EVENTS = Global_1.Konva._global['PointerEvent'] !== undefined;
11function getCapturedShape(pointerId) {
12 return Captures.get(pointerId);
13}
14function createEvent(evt) {
15 return {
16 evt,
17 pointerId: evt.pointerId,
18 };
19}
20function hasPointerCapture(pointerId, shape) {
21 return Captures.get(pointerId) === shape;
22}
23function setPointerCapture(pointerId, shape) {
24 releaseCapture(pointerId);
25 const stage = shape.getStage();
26 if (!stage)
27 return;
28 Captures.set(pointerId, shape);
29 if (SUPPORT_POINTER_EVENTS) {
30 shape._fire('gotpointercapture', createEvent(new PointerEvent('gotpointercapture')));
31 }
32}
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}
Note: See TracBrowser for help on using the repository browser.