fabric 6.0.0-beta11 → 6.0.0-beta13

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.
Files changed (59) hide show
  1. package/.gitmodules +3 -0
  2. package/.prettierignore +4 -3
  3. package/CHANGELOG.md +24 -0
  4. package/CONTRIBUTING.md +3 -1
  5. package/dist/index.js +110 -80
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.min.js +1 -1
  8. package/dist/index.mjs +110 -80
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/index.node.cjs +110 -80
  11. package/dist/index.node.cjs.map +1 -1
  12. package/dist/index.node.mjs +110 -80
  13. package/dist/index.node.mjs.map +1 -1
  14. package/dist/src/Collection.d.ts +1 -1
  15. package/dist/src/EventTypeDefs.d.ts +1 -0
  16. package/dist/src/canvas/SelectableCanvas.d.ts +4 -4
  17. package/dist/src/shapes/ActiveSelection.d.ts +15 -3
  18. package/dist/src/shapes/IText/ITextBehavior.d.ts +1 -1
  19. package/dist/src/shapes/Object/ObjectOrigin.d.ts +0 -14
  20. package/dist/src/shapes/Object/types/ObjectProps.d.ts +9 -0
  21. package/dist/src/shapes/Text/Text.d.ts +2 -2
  22. package/dist/src/shapes/Textbox.d.ts +3 -1
  23. package/dist/src/util/animation/types.d.ts +1 -1
  24. package/jest.config.js +1 -1
  25. package/jest.extend.ts +123 -0
  26. package/jest.setup.ts +5 -0
  27. package/package.json +4 -3
  28. package/playwright.setup.ts +1 -1
  29. package/src/Collection.ts +1 -1
  30. package/src/EventTypeDefs.ts +1 -0
  31. package/src/canvas/Canvas.ts +22 -16
  32. package/src/canvas/SelectableCanvas.ts +5 -4
  33. package/src/canvas/__tests__/__snapshots__/eventData.test.ts.snap +581 -0
  34. package/src/canvas/__tests__/eventData.test.ts +102 -0
  35. package/src/controls/polyControl.ts +12 -14
  36. package/src/controls/scale.ts +1 -1
  37. package/src/controls/wrapWithFixedAnchor.spec.ts +122 -0
  38. package/src/controls/wrapWithFixedAnchor.ts +7 -1
  39. package/src/shapes/ActiveSelection.spec.ts +89 -0
  40. package/src/shapes/ActiveSelection.ts +33 -11
  41. package/src/shapes/IText/ITextBehavior.test.ts +3 -4
  42. package/src/shapes/IText/ITextBehavior.ts +2 -1
  43. package/src/shapes/IText/__snapshots__/ITextBehavior.test.ts.snap +0 -6
  44. package/src/shapes/Object/InteractiveObject.ts +4 -1
  45. package/src/shapes/Object/Object.spec.ts +61 -0
  46. package/src/shapes/Object/Object.ts +18 -8
  47. package/src/shapes/Object/ObjectOrigin.ts +0 -48
  48. package/src/shapes/Object/types/ObjectProps.ts +10 -0
  49. package/src/shapes/Text/Text.spec.ts +3 -3
  50. package/src/shapes/Text/Text.ts +5 -4
  51. package/src/shapes/Text/__snapshots__/Text.spec.ts.snap +1 -1
  52. package/src/shapes/Textbox.spec.ts +4 -5
  53. package/src/shapes/Textbox.ts +6 -4
  54. package/src/shapes/__snapshots__/ActiveSelection.spec.ts.snap +43 -0
  55. package/src/shapes/__snapshots__/Textbox.spec.ts.snap +2 -3
  56. package/src/util/animation/types.ts +2 -1
  57. package/src/util/dom_misc.ts +3 -2
  58. package/typedoc.json +10 -0
  59. package/toMatchRoundedSnapshot.ts +0 -66
@@ -455,7 +455,7 @@ class Cache {
455
455
  }
456
456
  const cache = new Cache();
457
457
 
458
- var version = "6.0.0-beta11";
458
+ var version = "6.0.0-beta13";
459
459
 
460
460
  // use this syntax so babel plugin see this import here
461
461
  const VERSION = version;
@@ -1314,7 +1314,7 @@ function createCollectionMixin(Base) {
1314
1314
 
1315
1315
  /**
1316
1316
  * Returns true if collection contains an object.\
1317
- * **Prefer using {@link `FabricObject#isDescendantOf`} for performance reasons**
1317
+ * **Prefer using {@link FabricObject#isDescendantOf} for performance reasons**
1318
1318
  * instead of `a.contains(b)` use `b.isDescendantOf(a)`
1319
1319
  * @param {Object} object Object to check against
1320
1320
  * @param {Boolean} [deep=false] `true` to check all descendants, `false` to check only `_objects`
@@ -2827,15 +2827,15 @@ const isFabricObjectWithDragSupport = fabricObject => {
2827
2827
  * @return {Object} Object with left/top values
2828
2828
  */
2829
2829
  function getScrollLeftTop(element) {
2830
+ const doc = element && getDocumentFromElement(element);
2830
2831
  let left = 0,
2831
2832
  top = 0;
2832
- if (!element) {
2833
+ if (!element || !doc) {
2833
2834
  return {
2834
2835
  left,
2835
2836
  top
2836
2837
  };
2837
2838
  }
2838
- const doc = getDocumentFromElement(element);
2839
2839
  const docElement = doc.documentElement,
2840
2840
  body = doc.body || {
2841
2841
  scrollLeft: 0,
@@ -5976,38 +5976,6 @@ class ObjectOrigin extends CommonMethods {
5976
5976
  });
5977
5977
  }
5978
5978
 
5979
- /**
5980
- * Sets the origin/position of the object to it's center point
5981
- * @private
5982
- * @return {void}
5983
- */
5984
- _setOriginToCenter() {
5985
- this._originalOriginX = this.originX;
5986
- this._originalOriginY = this.originY;
5987
- const center = this.getRelativeCenterPoint();
5988
- this.originX = CENTER;
5989
- this.originY = CENTER;
5990
- this.left = center.x;
5991
- this.top = center.y;
5992
- }
5993
-
5994
- /**
5995
- * Resets the origin/position of the object to it's original origin
5996
- * @private
5997
- * @return {void}
5998
- */
5999
- _resetOrigin() {
6000
- if (this._originalOriginX !== undefined && this._originalOriginY !== undefined) {
6001
- const originPoint = this.translateToOriginPoint(this.getRelativeCenterPoint(), this._originalOriginX, this._originalOriginY);
6002
- this.left = originPoint.x;
6003
- this.top = originPoint.y;
6004
- this.originX = this._originalOriginX;
6005
- this.originY = this._originalOriginY;
6006
- this._originalOriginX = undefined;
6007
- this._originalOriginY = undefined;
6008
- }
6009
- }
6010
-
6011
5979
  /**
6012
5980
  * @private
6013
5981
  */
@@ -8272,13 +8240,31 @@ let FabricObject$1 = class FabricObject extends AnimatableObject {
8272
8240
  * @param {TDegree} angle Angle value (in degrees)
8273
8241
  */
8274
8242
  rotate(angle) {
8275
- const shouldCenterOrigin = (this.originX !== CENTER || this.originY !== CENTER) && this.centeredRotation;
8276
- if (shouldCenterOrigin) {
8277
- this._setOriginToCenter();
8243
+ const {
8244
+ centeredRotation,
8245
+ originX,
8246
+ originY
8247
+ } = this;
8248
+ if (centeredRotation) {
8249
+ const {
8250
+ x,
8251
+ y
8252
+ } = this.getRelativeCenterPoint();
8253
+ this.originX = CENTER;
8254
+ this.originY = CENTER;
8255
+ this.left = x;
8256
+ this.top = y;
8278
8257
  }
8279
8258
  this.set('angle', angle);
8280
- if (shouldCenterOrigin) {
8281
- this._resetOrigin();
8259
+ if (centeredRotation) {
8260
+ const {
8261
+ x,
8262
+ y
8263
+ } = this.translateToOriginPoint(this.getRelativeCenterPoint(), originX, originY);
8264
+ this.left = x;
8265
+ this.top = y;
8266
+ this.originX = originX;
8267
+ this.originY = originY;
8282
8268
  }
8283
8269
  }
8284
8270
 
@@ -8412,7 +8398,9 @@ function wrapWithFixedAnchor(actionHandler) {
8412
8398
  centerPoint = target.getRelativeCenterPoint(),
8413
8399
  constraint = target.translateToOriginPoint(centerPoint, originX, originY),
8414
8400
  actionPerformed = actionHandler(eventData, transform, x, y);
8415
- target.setPositionByOrigin(constraint, originX, originY);
8401
+ // flipping requires to change the transform origin, so we read from the mutated transform
8402
+ // instead of leveraging the one destructured before
8403
+ target.setPositionByOrigin(constraint, transform.originX, transform.originY);
8416
8404
  return actionPerformed;
8417
8405
  };
8418
8406
  }
@@ -9018,7 +9006,7 @@ function scaleObject(eventData, transform, x, y) {
9018
9006
  transform.signY = signY;
9019
9007
  }
9020
9008
  }
9021
- // minScale is taken are in the setter.
9009
+ // minScale is taken care of in the setter.
9022
9010
  const oldScaleX = target.scaleX,
9023
9011
  oldScaleY = target.scaleY;
9024
9012
  if (!by) {
@@ -9662,7 +9650,7 @@ class InteractiveFabricObject extends FabricObject$1 {
9662
9650
  // this is extremely confusing. options comes from the upper function
9663
9651
  // and is the qrDecompose of a matrix that takes in account zoom too
9664
9652
  new Point(options.scaleX, options.scaleY)).scalarMultiply(this.strokeWidth);
9665
- size = bbox.add(stroke).scalarAdd(this.borderScaleFactor);
9653
+ size = bbox.add(stroke).scalarAdd(this.borderScaleFactor).scalarAdd(this.padding * 2);
9666
9654
  } else {
9667
9655
  size = this._calculateCurrentDimensions().scalarAdd(this.borderScaleFactor);
9668
9656
  }
@@ -11407,9 +11395,22 @@ _defineProperty(Group, "type", 'Group');
11407
11395
  _defineProperty(Group, "ownDefaults", groupDefaultValues);
11408
11396
  classRegistry.setClass(Group);
11409
11397
 
11398
+ /**
11399
+ * Used by Canvas to manage selection.
11400
+ * Canvas accepts an `activeSelection` option allowing overriding and customization.
11401
+ *
11402
+ * @example
11403
+ * class MyActiveSelection extends ActiveSelection {
11404
+ * ...
11405
+ * }
11406
+ *
11407
+ * const canvas = new Canvas(el, {
11408
+ * activeSelection: new MyActiveSelection()
11409
+ * })
11410
+ */
11410
11411
  class ActiveSelection extends Group {
11411
- constructor(objects, options, objectsRelativeToGroup) {
11412
- super(objects, options, objectsRelativeToGroup);
11412
+ constructor() {
11413
+ super(...arguments);
11413
11414
  /**
11414
11415
  * controls how selected objects are added during a multiselection event
11415
11416
  * - `canvas-stacking` adds the selected object to the active selection while respecting canvas object stacking order
@@ -11419,9 +11420,7 @@ class ActiveSelection extends Group {
11419
11420
  */
11420
11421
  // TODO FIX THIS WITH THE DEFAULTS LOGIC
11421
11422
  _defineProperty(this, "multiSelectionStacking", 'canvas-stacking');
11422
- this.setCoords();
11423
11423
  }
11424
-
11425
11424
  /**
11426
11425
  * @private
11427
11426
  */
@@ -11526,6 +11525,24 @@ class ActiveSelection extends Group {
11526
11525
  this.removeAll();
11527
11526
  return false;
11528
11527
  }
11528
+ _applyLayoutStrategy(context) {
11529
+ super._applyLayoutStrategy(context);
11530
+ if (this._objects.length === 0) {
11531
+ // in this case layout was skipped
11532
+ // we reset transform for the next selection
11533
+ Object.assign(this, {
11534
+ left: 0,
11535
+ top: 0,
11536
+ angle: 0,
11537
+ scaleX: 1,
11538
+ scaleY: 1,
11539
+ skewX: 0,
11540
+ skewY: 0,
11541
+ flipX: false,
11542
+ flipY: false
11543
+ });
11544
+ }
11545
+ }
11529
11546
 
11530
11547
  /**
11531
11548
  * Returns string representation of a group
@@ -13578,6 +13595,7 @@ class SelectableCanvas extends StaticCanvas$1 {
13578
13595
  _defineProperty(this, "_activeSelection", void 0);
13579
13596
  this._activeSelection = activeSelection;
13580
13597
  this._activeSelection.set('canvas', this);
13598
+ this._activeSelection.setCoords();
13581
13599
  }
13582
13600
  initElements(el) {
13583
13601
  this.elements = new CanvasDOMManager(el, {
@@ -14022,7 +14040,7 @@ class SelectableCanvas extends StaticCanvas$1 {
14022
14040
 
14023
14041
  /**
14024
14042
  * Function used to search inside objects an object that contains pointer in bounding box or that contains pointerOnCanvas when painted
14025
- * @see {@link fabric.Canvas#_searchPossibleTargets}
14043
+ * @see {@link _searchPossibleTargets}
14026
14044
  * @param {FabricObject[]} [objects] objects array to look into
14027
14045
  * @param {Object} [pointer] x,y object of point coordinates we want to check.
14028
14046
  * @return {FabricObject} **top most object on screen** that contains pointer
@@ -14053,9 +14071,9 @@ class SelectableCanvas extends StaticCanvas$1 {
14053
14071
  * by the viewportTransform ( sort of coordinates of what is displayed
14054
14072
  * on the canvas where you are clicking.
14055
14073
  * ignoreVpt true = HTMLElement coordinates relative to top,left
14056
- * ignoreVpt false, default = fabric space coordinates, the same used for shape position
14057
- * To interact with your shapes top and left you want to use ignoreVpt true
14058
- * most of the time, while ignoreVpt false will give you coordinates
14074
+ * ignoreVpt false, default = fabric space coordinates, the same used for shape position.
14075
+ * To interact with your shapes top and left you want to use ignoreVpt false
14076
+ * most of the time, while ignoreVpt true will give you coordinates
14059
14077
  * compatible with the object.oCoords system.
14060
14078
  * of the time.
14061
14079
  * @param {Event} e
@@ -14642,8 +14660,8 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
14642
14660
  const shared = {
14643
14661
  e,
14644
14662
  isClick: false,
14645
- pointer: this.getPointer(e),
14646
- absolutePointer: this.getPointer(e, true)
14663
+ pointer: this.getPointer(e, true),
14664
+ absolutePointer: this.getPointer(e)
14647
14665
  };
14648
14666
  this.fire('mouse:out', _objectSpread2(_objectSpread2({}, shared), {}, {
14649
14667
  target
@@ -14674,8 +14692,8 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
14674
14692
  this.fire('mouse:over', {
14675
14693
  e,
14676
14694
  isClick: false,
14677
- pointer: this.getPointer(e),
14678
- absolutePointer: this.getPointer(e, true)
14695
+ pointer: this.getPointer(e, true),
14696
+ absolutePointer: this.getPointer(e)
14679
14697
  });
14680
14698
  this._hoveredTarget = undefined;
14681
14699
  this._hoveredTargets = [];
@@ -14907,7 +14925,8 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
14907
14925
  target,
14908
14926
  subTargets: targets,
14909
14927
  dragSource: this._dragSource,
14910
- pointer: this.getPointer(e)
14928
+ pointer: this.getPointer(e, true),
14929
+ absolutePointer: this.getPointer(e)
14911
14930
  });
14912
14931
  // will be set by the drop target
14913
14932
  options.didDrop = false;
@@ -15224,8 +15243,8 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
15224
15243
  subTargets: targets,
15225
15244
  button,
15226
15245
  isClick,
15227
- pointer: this.getPointer(e),
15228
- absolutePointer: this.getPointer(e, true),
15246
+ pointer: this.getPointer(e, true),
15247
+ absolutePointer: this.getPointer(e),
15229
15248
  transform: this._currentTransform
15230
15249
  };
15231
15250
  if (eventType === 'up') {
@@ -15289,6 +15308,7 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
15289
15308
  this.discardActiveObject(e);
15290
15309
  this.requestRenderAll();
15291
15310
  }
15311
+ // this is an absolute pointer, the naming is wrong
15292
15312
  const pointer = this.getPointer(e);
15293
15313
  this.freeDrawingBrush && this.freeDrawingBrush.onMouseDown(pointer, {
15294
15314
  e,
@@ -15306,6 +15326,7 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
15306
15326
  const pointer = this.getPointer(e);
15307
15327
  this.freeDrawingBrush && this.freeDrawingBrush.onMouseMove(pointer, {
15308
15328
  e,
15329
+ // this is an absolute pointer, the naming is wrong
15309
15330
  pointer
15310
15331
  });
15311
15332
  }
@@ -15322,6 +15343,7 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
15322
15343
  if (this.freeDrawingBrush) {
15323
15344
  this._isCurrentlyDrawing = !!this.freeDrawingBrush.onMouseUp({
15324
15345
  e: e,
15346
+ // this is an absolute pointer, the naming is wrong
15325
15347
  pointer: pointer
15326
15348
  });
15327
15349
  } else {
@@ -15577,8 +15599,8 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
15577
15599
  target: oldTarget,
15578
15600
  nextTarget: target,
15579
15601
  isClick: false,
15580
- pointer: this.getPointer(e),
15581
- absolutePointer: this.getPointer(e, true)
15602
+ pointer: this.getPointer(e, true),
15603
+ absolutePointer: this.getPointer(e)
15582
15604
  });
15583
15605
  fireCanvas && this.fire(canvasIn, outOpt);
15584
15606
  oldTarget.fire(targetOut, outOpt);
@@ -15589,8 +15611,8 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
15589
15611
  target,
15590
15612
  previousTarget: oldTarget,
15591
15613
  isClick: false,
15592
- pointer: this.getPointer(e),
15593
- absolutePointer: this.getPointer(e, true)
15614
+ pointer: this.getPointer(e, true),
15615
+ absolutePointer: this.getPointer(e)
15594
15616
  });
15595
15617
  fireCanvas && this.fire(canvasOut, inOpt);
15596
15618
  target.fire(targetIn, inOpt);
@@ -15718,8 +15740,13 @@ let Canvas$1 = class Canvas extends SelectableCanvas {
15718
15740
  if (isAS) {
15719
15741
  const prevActiveObjects = activeSelection.getObjects();
15720
15742
  if (target === activeSelection) {
15721
- // find target from active objects
15722
- target = this.searchPossibleTargets(prevActiveObjects, this.getPointer(e, true));
15743
+ const pointer = this.getPointer(e, true);
15744
+ target =
15745
+ // first search active objects for a target to remove
15746
+ this.searchPossibleTargets(prevActiveObjects, pointer) ||
15747
+ // if not found, search under active selection for a target to add
15748
+ // `prevActiveObjects` will be searched but we already know they will not be found
15749
+ this.searchPossibleTargets(this._objects, pointer);
15723
15750
  // if nothing is found bail out
15724
15751
  if (!target || !target.selectable) {
15725
15752
  return false;
@@ -19116,10 +19143,10 @@ class Text extends StyledText {
19116
19143
  /**
19117
19144
  * Detect if a line has a linebreak and so we need to account for it when moving
19118
19145
  * and counting style.
19119
- * It return always for text and Itext.
19146
+ * It return always 1 for text and Itext. Textbox has its own implementation
19120
19147
  * @return Number
19121
19148
  */
19122
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
19149
+
19123
19150
  missingNewlineOffset(lineIndex) {
19124
19151
  return 1;
19125
19152
  }
@@ -19139,7 +19166,7 @@ class Text extends StyledText {
19139
19166
  charIndex: selectionStart
19140
19167
  };
19141
19168
  }
19142
- selectionStart -= lines[i].length + this.missingNewlineOffset(i);
19169
+ selectionStart -= lines[i].length + this.missingNewlineOffset(i, skipWrapping);
19143
19170
  }
19144
19171
  return {
19145
19172
  lineIndex: i - 1,
@@ -20603,8 +20630,7 @@ class DraggableTextDelegate {
20603
20630
  * - `!` Matches a "!" character (char code 33).
20604
20631
  * - `\?` Matches a "?" character (char code 63).
20605
20632
  * - `\-` Matches a "-" character (char code 45).
20606
- */
20607
- // eslint-disable-next-line no-useless-escape
20633
+ */ // eslint-disable-next-line no-useless-escape
20608
20634
  const reNonWord = /[ \n\.,;!\?\-]/;
20609
20635
  class ITextBehavior extends Text {
20610
20636
  constructor() {
@@ -20891,7 +20917,7 @@ class ITextBehavior extends Text {
20891
20917
  }
20892
20918
 
20893
20919
  /**
20894
- * called by {@link canvas#textEditingManager}
20920
+ * called by {@link Canvas#textEditingManager}
20895
20921
  */
20896
20922
  updateSelectionOnMouseMove(e) {
20897
20923
  if (this.getActiveControl()) {
@@ -23146,14 +23172,17 @@ class Textbox extends IText {
23146
23172
  let offset = 0;
23147
23173
  const wordsOrGraphemes = splitByGrapheme ? this.graphemeSplit(line) : this.wordSplit(line);
23148
23174
  if (wordsOrGraphemes.length === 0) {
23149
- return [];
23175
+ return [{
23176
+ word: [],
23177
+ width: 0
23178
+ }];
23150
23179
  }
23151
23180
  return wordsOrGraphemes.map(word => {
23152
23181
  // if using splitByGrapheme words are already in graphemes.
23153
23182
  const graphemeArray = splitByGrapheme ? [word] : this.graphemeSplit(word);
23154
23183
  const width = this._measureWord(graphemeArray, lineIndex, offset);
23155
23184
  largestWordWidth = Math.max(width, largestWordWidth);
23156
- offset += word.length + infix.length;
23185
+ offset += graphemeArray.length + infix.length;
23157
23186
  return {
23158
23187
  word: graphemeArray,
23159
23188
  width
@@ -23289,10 +23318,12 @@ class Textbox extends IText {
23289
23318
  /**
23290
23319
  * Detect if a line has a linebreak and so we need to account for it when moving
23291
23320
  * and counting style.
23321
+ * This is important only for splitByGrapheme at the end of wrapping.
23322
+ * If we are not wrapping the offset is always 1
23292
23323
  * @return Number
23293
23324
  */
23294
- missingNewlineOffset(lineIndex) {
23295
- if (this.splitByGrapheme) {
23325
+ missingNewlineOffset(lineIndex, skipWrapping) {
23326
+ if (this.splitByGrapheme && !skipWrapping) {
23296
23327
  return this.isEndOfWrapping(lineIndex) ? 1 : 0;
23297
23328
  }
23298
23329
  return 1;
@@ -25068,15 +25099,14 @@ const polyActionHandler = (eventData, transform, x, y) => {
25068
25099
  const anchorWrapper = (pointIndex, fn) => {
25069
25100
  return function (eventData, transform, x, y) {
25070
25101
  const poly = transform.target,
25071
- anchorIndex = (pointIndex > 0 ? pointIndex : poly.points.length) - 1,
25072
- pointInParentPlane = new Point(poly.points[anchorIndex].x - poly.pathOffset.x, poly.points[anchorIndex].y - poly.pathOffset.y).transform(poly.calcOwnMatrix()),
25102
+ anchorPoint = new Point(poly.points[(pointIndex > 0 ? pointIndex : poly.points.length) - 1]),
25103
+ anchorPointInParentPlane = anchorPoint.subtract(poly.pathOffset).transform(poly.calcOwnMatrix()),
25073
25104
  actionPerformed = fn(eventData, _objectSpread2(_objectSpread2({}, transform), {}, {
25074
25105
  pointIndex
25075
25106
  }), x, y),
25076
- polygonBaseSize = getSize(poly),
25077
25107
  adjustFlip = new Point(poly.flipX ? -1 : 1, poly.flipY ? -1 : 1);
25078
- const newPosition = new Point(poly.points[anchorIndex].x, poly.points[anchorIndex].y).subtract(poly.pathOffset).divide(polygonBaseSize).multiply(adjustFlip);
25079
- poly.setPositionByOrigin(pointInParentPlane, newPosition.x + 0.5, newPosition.y + 0.5);
25108
+ const newPositionNormalized = anchorPoint.subtract(poly.pathOffset).divide(poly._getNonTransformedDimensions()).multiply(adjustFlip);
25109
+ poly.setPositionByOrigin(anchorPointInParentPlane, newPositionNormalized.x + 0.5, newPositionNormalized.y + 0.5);
25080
25110
  return actionPerformed;
25081
25111
  };
25082
25112
  };