@eclipse-glsp/client 2.3.0-next.380 → 2.3.0-next.381

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,12 +14,10 @@
14
14
  *
15
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
16
  ********************************************************************************/
17
- import { Action, DOMHelper, GModelElement, MousePositionTracker, ViewerOptions } from '@eclipse-glsp/sprotty';
17
+ import { Action, GModelElement, MousePositionTracker } from '@eclipse-glsp/sprotty';
18
18
  import { Ranked } from './ranked';
19
19
  export declare class GLSPMousePositionTracker extends MousePositionTracker implements Ranked {
20
20
  rank: number;
21
- protected viewerOptions: ViewerOptions;
22
- protected domHelper: DOMHelper;
23
21
  mouseMove(target: GModelElement, event: MouseEvent): (Action | Promise<Action>)[];
24
22
  }
25
23
  //# sourceMappingURL=mouse-position-tracker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mouse-position-tracker.d.ts","sourceRoot":"","sources":["../../src/base/mouse-position-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;kFAekF;AAClF,OAAO,EACH,MAAM,EACN,SAAS,EACT,aAAa,EACb,oBAAoB,EAGpB,aAAa,EAEhB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBACa,wBAAyB,SAAQ,oBAAqB,YAAW,MAAM;IAEhF,IAAI,SAA6B;IAEJ,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAC3C,SAAS,CAAC,SAAS,EAAE,SAAS,CAAC;IAE/C,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;CAU7F"}
1
+ {"version":3,"file":"mouse-position-tracker.d.ts","sourceRoot":"","sources":["../../src/base/mouse-position-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;kFAekF;AAClF,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,oBAAoB,EAAS,MAAM,uBAAuB,CAAC;AAE3F,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBACa,wBAAyB,SAAQ,oBAAqB,YAAW,MAAM;IAEhF,IAAI,SAA6B;IAExB,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;CAU7F"}
@@ -5,9 +5,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
8
  Object.defineProperty(exports, "__esModule", { value: true });
12
9
  exports.GLSPMousePositionTracker = void 0;
13
10
  /********************************************************************************
@@ -38,23 +35,15 @@ let GLSPMousePositionTracker = class GLSPMousePositionTracker extends sprotty_1.
38
35
  mouseMove(target, event) {
39
36
  // we cannot simply use the offsetX and offsetY properties of the event since they also consider nested HTML elements
40
37
  // such as foreignObjects or the projection bars divs. Instead, we manually translate the client coordinates to the diagram
41
- const clientToRoot = (0, sprotty_1.getAbsoluteClientBounds)(target.root, this.domHelper, this.viewerOptions);
38
+ const globalOrigin = target.root.canvasBounds;
42
39
  const clientToPosition = { x: event.clientX, y: event.clientY };
43
- const rootToPosition = sprotty_1.Point.subtract(clientToPosition, clientToRoot);
40
+ const rootToPosition = sprotty_1.Point.subtract(clientToPosition, globalOrigin);
44
41
  const positionOnDiagram = target.root.parentToLocal(rootToPosition);
45
42
  this.lastPosition = positionOnDiagram;
46
43
  return [];
47
44
  }
48
45
  };
49
46
  exports.GLSPMousePositionTracker = GLSPMousePositionTracker;
50
- __decorate([
51
- (0, inversify_1.inject)(sprotty_1.TYPES.ViewerOptions),
52
- __metadata("design:type", Object)
53
- ], GLSPMousePositionTracker.prototype, "viewerOptions", void 0);
54
- __decorate([
55
- (0, inversify_1.inject)(sprotty_1.TYPES.DOMHelper),
56
- __metadata("design:type", sprotty_1.DOMHelper)
57
- ], GLSPMousePositionTracker.prototype, "domHelper", void 0);
58
47
  exports.GLSPMousePositionTracker = GLSPMousePositionTracker = __decorate([
59
48
  (0, inversify_1.injectable)()
60
49
  ], GLSPMousePositionTracker);
@@ -1 +1 @@
1
- {"version":3,"file":"mouse-position-tracker.js","sourceRoot":"","sources":["../../src/base/mouse-position-tracker.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;kFAekF;AAClF,mDAS+B;AAC/B,yCAA+C;AAC/C,qCAAkC;AAG3B,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,8BAAoB;IAA3D;;QACH,8HAA8H;QAC9H,SAAI,GAAG,eAAM,CAAC,YAAY,GAAG,GAAG,CAAC;IAerC,CAAC;IAVY,SAAS,CAAC,MAAqB,EAAE,KAAiB;QACvD,qHAAqH;QACrH,2HAA2H;QAC3H,MAAM,YAAY,GAAG,IAAA,iCAAuB,EAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9F,MAAM,gBAAgB,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAChE,MAAM,cAAc,GAAG,eAAK,CAAC,QAAQ,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QACtE,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,YAAY,GAAG,iBAAiB,CAAC;QACtC,OAAO,EAAE,CAAC;IACd,CAAC;CACJ,CAAA;AAjBY,4DAAwB;AAIM;IAAtC,IAAA,kBAAM,EAAC,eAAK,CAAC,aAAa,CAAC;;+DAAwC;AACjC;IAAlC,IAAA,kBAAM,EAAC,eAAK,CAAC,SAAS,CAAC;8BAAsB,mBAAS;2DAAC;mCAL/C,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAiBpC"}
1
+ {"version":3,"file":"mouse-position-tracker.js","sourceRoot":"","sources":["../../src/base/mouse-position-tracker.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;kFAekF;AAClF,mDAA2F;AAC3F,yCAAuC;AACvC,qCAAkC;AAG3B,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,8BAAoB;IAA3D;;QACH,8HAA8H;QAC9H,SAAI,GAAG,eAAM,CAAC,YAAY,GAAG,GAAG,CAAC;IAYrC,CAAC;IAVY,SAAS,CAAC,MAAqB,EAAE,KAAiB;QACvD,qHAAqH;QACrH,2HAA2H;QAC3H,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;QAC9C,MAAM,gBAAgB,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAChE,MAAM,cAAc,GAAG,eAAK,CAAC,QAAQ,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QACtE,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QACpE,IAAI,CAAC,YAAY,GAAG,iBAAiB,CAAC;QACtC,OAAO,EAAE,CAAC;IACd,CAAC;CACJ,CAAA;AAdY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAcpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/client",
3
- "version": "2.3.0-next.380+b01477a",
3
+ "version": "2.3.0-next.381+d472c7a",
4
4
  "description": "A sprotty-based client for GLSP",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -46,7 +46,7 @@
46
46
  "watch": "tsc -w"
47
47
  },
48
48
  "dependencies": {
49
- "@eclipse-glsp/sprotty": "2.3.0-next.380+b01477a",
49
+ "@eclipse-glsp/sprotty": "2.3.0-next.381+d472c7a",
50
50
  "autocompleter": "^9.1.2",
51
51
  "file-saver": "^2.0.5",
52
52
  "lodash": "4.17.21",
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "b01477a769ebb7798248491db8576b46838695f8"
66
+ "gitHead": "d472c7a8ca5e38a813c9053fe05e12f5dae0e4cd"
67
67
  }
@@ -14,17 +14,8 @@
14
14
  *
15
15
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
16
  ********************************************************************************/
17
- import {
18
- Action,
19
- DOMHelper,
20
- GModelElement,
21
- MousePositionTracker,
22
- Point,
23
- TYPES,
24
- ViewerOptions,
25
- getAbsoluteClientBounds
26
- } from '@eclipse-glsp/sprotty';
27
- import { inject, injectable } from 'inversify';
17
+ import { Action, GModelElement, MousePositionTracker, Point } from '@eclipse-glsp/sprotty';
18
+ import { injectable } from 'inversify';
28
19
  import { Ranked } from './ranked';
29
20
 
30
21
  @injectable()
@@ -32,15 +23,12 @@ export class GLSPMousePositionTracker extends MousePositionTracker implements Ra
32
23
  /* we want to be executed before all default mouse listeners since we are just tracking the position and others may need it */
33
24
  rank = Ranked.DEFAULT_RANK - 200;
34
25
 
35
- @inject(TYPES.ViewerOptions) protected viewerOptions: ViewerOptions;
36
- @inject(TYPES.DOMHelper) protected domHelper: DOMHelper;
37
-
38
26
  override mouseMove(target: GModelElement, event: MouseEvent): (Action | Promise<Action>)[] {
39
27
  // we cannot simply use the offsetX and offsetY properties of the event since they also consider nested HTML elements
40
28
  // such as foreignObjects or the projection bars divs. Instead, we manually translate the client coordinates to the diagram
41
- const clientToRoot = getAbsoluteClientBounds(target.root, this.domHelper, this.viewerOptions);
29
+ const globalOrigin = target.root.canvasBounds;
42
30
  const clientToPosition = { x: event.clientX, y: event.clientY };
43
- const rootToPosition = Point.subtract(clientToPosition, clientToRoot);
31
+ const rootToPosition = Point.subtract(clientToPosition, globalOrigin);
44
32
  const positionOnDiagram = target.root.parentToLocal(rootToPosition);
45
33
  this.lastPosition = positionOnDiagram;
46
34
  return [];