@joint/core 4.1.2 → 4.1.3

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.
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.1.2 (2025-01-16) - JavaScript diagramming library
1
+ /*! JointJS v4.1.3 (2025-02-04) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
@@ -1,4 +1,4 @@
1
- /*! JointJS v4.1.2 (2025-01-16) - JavaScript diagramming library
1
+ /*! JointJS v4.1.3 (2025-02-04) - JavaScript diagramming library
2
2
 
3
3
 
4
4
  This Source Code Form is subject to the terms of the Mozilla Public
package/dist/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- var version = "4.1.2";
1
+ var version = "4.1.3";
2
2
 
3
3
  export { version };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joint/core",
3
3
  "title": "JointJS",
4
- "version": "4.1.2",
4
+ "version": "4.1.3",
5
5
  "description": "JavaScript diagramming library",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/joint.min.js",
@@ -804,17 +804,23 @@ export const ElementView = CellView.extend({
804
804
 
805
805
  // Drag Handlers
806
806
 
807
+ snapToGrid: function(evt, x, y) {
808
+ const grid = this.paper.options.gridSize;
809
+ return {
810
+ x: snapToGrid(x, grid),
811
+ y: snapToGrid(y, grid)
812
+ };
813
+ },
814
+
807
815
  drag: function(evt, x, y) {
808
816
 
809
817
  var paper = this.paper;
810
- var grid = paper.options.gridSize;
811
818
  var element = this.model;
812
819
  var data = this.eventData(evt);
813
820
  var { pointerOffset, restrictedArea, embedding } = data;
814
821
 
815
822
  // Make sure the new element's position always snaps to the current grid
816
- var elX = snapToGrid(x + pointerOffset.x, grid);
817
- var elY = snapToGrid(y + pointerOffset.y, grid);
823
+ const { x: elX, y: elY } = this.snapToGrid(evt, x + pointerOffset.x, y + pointerOffset.y);
818
824
 
819
825
  element.position(elX, elY, { restrictedArea, deep: true, ui: true });
820
826
 
@@ -337,8 +337,8 @@ export function position() {
337
337
  doc = el.ownerDocument;
338
338
  offsetParent = el.offsetParent || doc.documentElement;
339
339
  const isStaticallyPositioned = (el) => {
340
- const { position } = el.style;
341
- return !position || position === 'static';
340
+ const { position } = getComputedStyle(el);
341
+ return position === 'static';
342
342
  };
343
343
  while (offsetParent && offsetParent !== doc.documentElement && isStaticallyPositioned(offsetParent)) {
344
344
  offsetParent = offsetParent.offsetParent || doc.documentElement;
package/types/joint.d.ts CHANGED
@@ -1090,6 +1090,8 @@ export namespace dia {
1090
1090
 
1091
1091
  protected dragMagnetEnd(evt: dia.Event, x: number, y: number): void;
1092
1092
 
1093
+ protected snapToGrid(evt: dia.Event, x: number, y: number): dia.Point;
1094
+
1093
1095
  protected prepareEmbedding(data: any): void;
1094
1096
 
1095
1097
  protected processEmbedding(data: any, evt: dia.Event, x: number, y: number): void;