@leafer-draw/worker 1.9.5 → 1.9.6

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.
@@ -372,7 +372,7 @@ function getMatrixData() {
372
372
 
373
373
  const {sin: sin$5, cos: cos$5, acos: acos, sqrt: sqrt$3} = Math;
374
374
 
375
- const {float: float$1} = MathHelper;
375
+ const {float: float$2} = MathHelper;
376
376
 
377
377
  const tempPoint$3 = {};
378
378
 
@@ -614,12 +614,12 @@ const MatrixHelper = {
614
614
  const cosR = c / scaleY;
615
615
  rotation = PI_2 - (d > 0 ? acos(-cosR) : -acos(cosR));
616
616
  }
617
- const cosR = float$1(cos$5(rotation));
617
+ const cosR = float$2(cos$5(rotation));
618
618
  const sinR = sin$5(rotation);
619
- scaleX = float$1(scaleX), scaleY = float$1(scaleY);
620
- skewX = cosR ? float$1((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
621
- skewY = cosR ? float$1((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
622
- rotation = float$1(rotation / OneRadian);
619
+ scaleX = float$2(scaleX), scaleY = float$2(scaleY);
620
+ skewX = cosR ? float$2((c / scaleY + sinR) / cosR / OneRadian, 9) : 0;
621
+ skewY = cosR ? float$2((b / scaleX - sinR) / cosR / OneRadian, 9) : 0;
622
+ rotation = float$2(rotation / OneRadian);
623
623
  } else {
624
624
  scaleX = a;
625
625
  scaleY = d;
@@ -1141,7 +1141,7 @@ const {tempPointBounds: tempPointBounds$1, setPoint: setPoint$2, addPoint: addPo
1141
1141
 
1142
1142
  const {toOuterPoint: toOuterPoint$2} = MatrixHelper;
1143
1143
 
1144
- const {float: float, fourNumber: fourNumber} = MathHelper;
1144
+ const {float: float$1, fourNumber: fourNumber} = MathHelper;
1145
1145
 
1146
1146
  const {floor: floor$2, ceil: ceil$2} = Math;
1147
1147
 
@@ -1324,10 +1324,10 @@ const BoundsHelper = {
1324
1324
  }
1325
1325
  },
1326
1326
  float(t, maxLength) {
1327
- t.x = float(t.x, maxLength);
1328
- t.y = float(t.y, maxLength);
1329
- t.width = float(t.width, maxLength);
1330
- t.height = float(t.height, maxLength);
1327
+ t.x = float$1(t.x, maxLength);
1328
+ t.y = float$1(t.y, maxLength);
1329
+ t.width = float$1(t.width, maxLength);
1330
+ t.height = float$1(t.height, maxLength);
1331
1331
  },
1332
1332
  add(t, bounds, isPoint) {
1333
1333
  right$1 = t.x + t.width;
@@ -5463,6 +5463,8 @@ LeaferEvent.RESTART = "leafer.restart";
5463
5463
 
5464
5464
  LeaferEvent.END = "leafer.end";
5465
5465
 
5466
+ LeaferEvent.UPDATE_MODE = "leafer.update_mode";
5467
+
5466
5468
  LeaferEvent.TRANSFORM = "leafer.transform";
5467
5469
 
5468
5470
  LeaferEvent.MOVE = "leafer.move";
@@ -6749,7 +6751,7 @@ class LeafLevelList {
6749
6751
  }
6750
6752
  }
6751
6753
 
6752
- const version = "1.9.5";
6754
+ const version = "1.9.6";
6753
6755
 
6754
6756
  class LeaferCanvas extends LeaferCanvasBase {
6755
6757
  get allowBackgroundColor() {
@@ -7749,8 +7751,6 @@ class TextData extends UIData {
7749
7751
  if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
7750
7752
  box.set(value);
7751
7753
  if (boxLayout.strokeChanged) layout.strokeChange();
7752
- if (boxLayout.renderChanged) layout.renderChange();
7753
- box.__updateChange();
7754
7754
  } else if (box) {
7755
7755
  t.__box = box.parent = null;
7756
7756
  box.destroy();
@@ -7820,7 +7820,7 @@ const UIBounds = {
7820
7820
  __updateRenderSpread() {
7821
7821
  let width = 0;
7822
7822
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
7823
- if (shadow) shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
7823
+ if (shadow) width = Effect.getShadowSpread(this, shadow);
7824
7824
  if (blur) width = Math.max(width, blur);
7825
7825
  if (filter) width += Filter.getSpread(filter);
7826
7826
  if (renderSpread) width += renderSpread;
@@ -7833,36 +7833,69 @@ const UIBounds = {
7833
7833
  }
7834
7834
  };
7835
7835
 
7836
+ const {float: float} = MathHelper;
7837
+
7838
+ const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
7839
+
7836
7840
  const DragBoundsHelper = {
7841
+ limitMove(leaf, move) {
7842
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7843
+ if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
7844
+ D.axisMove(leaf, move);
7845
+ },
7846
+ limitScaleOf(leaf, origin, scale) {
7847
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7848
+ if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
7849
+ },
7850
+ axisMove(leaf, move) {
7851
+ const {draggable: draggable} = leaf;
7852
+ if (draggable === "x") move.y = 0;
7853
+ if (draggable === "y") move.x = 0;
7854
+ },
7855
+ getDragBounds(leaf) {
7856
+ const {dragBounds: dragBounds} = leaf;
7857
+ return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
7858
+ },
7859
+ isInnerMode(content, dragBounds, dragBoundsType, sideType) {
7860
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
7861
+ },
7837
7862
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
7838
7863
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
7839
7864
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
7840
7865
  if (!change) move = Object.assign({}, move);
7841
- const isBiggerWidth = content.width > dragBounds.width;
7842
- const isBiggerHeight = content.height > dragBounds.height;
7843
- if (isBiggerWidth && dragBoundsType !== "outer") {
7866
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7844
7867
  if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
7845
7868
  } else {
7846
7869
  if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
7847
7870
  }
7848
- if (isBiggerHeight && dragBoundsType !== "outer") {
7871
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7849
7872
  if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
7850
7873
  } else {
7851
7874
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
7852
7875
  }
7853
- move.x = MathHelper.float(move.x);
7854
- move.y = MathHelper.float(move.y);
7876
+ move.x = float(move.x);
7877
+ move.y = float(move.y);
7855
7878
  return move;
7856
7879
  },
7857
- axisMove(leaf, move) {
7858
- const {draggable: draggable} = leaf;
7859
- if (draggable === "x") move.y = 0;
7860
- if (draggable === "y") move.x = 0;
7861
- },
7862
- limitMove(leaf, move) {
7863
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7864
- if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
7865
- D.axisMove(leaf, move);
7880
+ getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
7881
+ if (!change) scale = Object.assign({}, scale);
7882
+ let fitScaleX, fitScaleY;
7883
+ tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
7884
+ tempMerge.set(tempContent).add(dragBounds);
7885
+ tempIntersect.set(tempContent).intersect(dragBounds);
7886
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7887
+ fitScaleX = tempMerge.width / tempContent.width;
7888
+ } else {
7889
+ fitScaleX = tempIntersect.width / tempContent.width;
7890
+ }
7891
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
7892
+ fitScaleY = tempMerge.height / tempContent.height;
7893
+ } else {
7894
+ fitScaleY = tempIntersect.height / tempContent.height;
7895
+ }
7896
+ scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
7897
+ scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
7898
+ return scale;
7866
7899
  }
7867
7900
  };
7868
7901
 
@@ -7880,7 +7913,7 @@ const UIRender = {
7880
7913
  }
7881
7914
  if (data.__useEffect) {
7882
7915
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
7883
- stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
7916
+ stintSet$1(data, "__isFastShadow", shadow && !otherEffect && shadow.length < 2 && !shadow[0].spread && !Effect.isTransformShadow(shadow[0]) && fill && !data.__isTransparentFill && !(isArray(fill) && fill.length > 1) && (this.useFastShadow || !stroke || stroke && data.strokeAlign === "inside"));
7884
7917
  data.__useEffect = !!(shadow || otherEffect);
7885
7918
  }
7886
7919
  data.__checkSingle();
@@ -8518,7 +8551,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8518
8551
  } else if (attrName === "zIndex") {
8519
8552
  this.canvas.zIndex = newValue;
8520
8553
  setTimeout(() => this.parent && this.parent.__updateSortChildren());
8521
- }
8554
+ } else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
8555
+ mode: newValue
8556
+ });
8522
8557
  }
8523
8558
  return super.__setAttr(attrName, newValue);
8524
8559
  }
@@ -8701,6 +8736,8 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
8701
8736
 
8702
8737
  __decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
8703
8738
 
8739
+ __decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
8740
+
8704
8741
  Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
8705
8742
 
8706
8743
  let Rect = class Rect extends UI {
@@ -8893,57 +8930,9 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
8893
8930
 
8894
8931
  Ellipse = __decorate([ registerUI() ], Ellipse);
8895
8932
 
8896
- const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
8897
-
8898
- const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
8899
-
8900
- let Line = class Line extends UI {
8901
- get __tag() {
8902
- return "Line";
8903
- }
8904
- get toPoint() {
8905
- const {width: width, rotation: rotation} = this.__;
8906
- const to = getPointData();
8907
- if (width) to.x = width;
8908
- if (rotation) rotate$1(to, rotation);
8909
- return to;
8910
- }
8911
- set toPoint(value) {
8912
- this.width = getDistance$2(defaultPoint, value);
8913
- this.rotation = getAngle$1(defaultPoint, value);
8914
- if (this.height) this.height = 0;
8915
- }
8916
- __updatePath() {
8917
- const data = this.__;
8918
- const path = data.path = [];
8919
- if (data.points) {
8920
- drawPoints$1(path, data.points, data.curve, data.closed);
8921
- } else {
8922
- moveTo$2(path, 0, 0);
8923
- lineTo$2(path, this.width, 0);
8924
- }
8925
- }
8926
- };
8927
-
8928
- __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
8929
-
8930
- __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
8931
-
8932
- __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
8933
-
8934
- __decorate([ pathType() ], Line.prototype, "points", void 0);
8935
-
8936
- __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
8937
-
8938
- __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
8939
-
8940
- Line = __decorate([ registerUI() ], Line);
8941
-
8942
8933
  const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
8943
8934
 
8944
- const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints: drawPoints} = PathCommandDataHelper;
8945
-
8946
- const line = Line.prototype;
8935
+ const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
8947
8936
 
8948
8937
  let Polygon = class Polygon extends UI {
8949
8938
  get __tag() {
@@ -8953,19 +8942,17 @@ let Polygon = class Polygon extends UI {
8953
8942
  const data = this.__;
8954
8943
  const path = data.path = [];
8955
8944
  if (data.points) {
8956
- drawPoints(path, data.points, data.curve, true);
8945
+ drawPoints$1(path, data.points, data.curve, true);
8957
8946
  } else {
8958
8947
  const {width: width, height: height, sides: sides} = data;
8959
8948
  const rx = width / 2, ry = height / 2;
8960
- moveTo$1(path, rx, 0);
8949
+ moveTo$2(path, rx, 0);
8961
8950
  for (let i = 1; i < sides; i++) {
8962
- lineTo$1(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
8951
+ lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
8963
8952
  }
8964
8953
  closePath$1(path);
8965
8954
  }
8966
8955
  }
8967
- __updateRenderPath() {}
8968
- __updateBoxBounds() {}
8969
8956
  };
8970
8957
 
8971
8958
  __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
@@ -8976,15 +8963,11 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
8976
8963
 
8977
8964
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
8978
8965
 
8979
- __decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
8980
-
8981
- __decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
8982
-
8983
8966
  Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
8984
8967
 
8985
8968
  const {sin: sin, cos: cos, PI: PI} = Math;
8986
8969
 
8987
- const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
8970
+ const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
8988
8971
 
8989
8972
  let Star = class Star extends UI {
8990
8973
  get __tag() {
@@ -8994,9 +8977,9 @@ let Star = class Star extends UI {
8994
8977
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
8995
8978
  const rx = width / 2, ry = height / 2;
8996
8979
  const path = this.__.path = [];
8997
- moveTo(path, rx, 0);
8980
+ moveTo$1(path, rx, 0);
8998
8981
  for (let i = 1; i < corners * 2; i++) {
8999
- lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
8982
+ lineTo$1(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
9000
8983
  }
9001
8984
  closePath(path);
9002
8985
  }
@@ -9010,6 +8993,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9010
8993
 
9011
8994
  Star = __decorate([ registerUI() ], Star);
9012
8995
 
8996
+ const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
8997
+
8998
+ const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
8999
+
9000
+ let Line = class Line extends UI {
9001
+ get __tag() {
9002
+ return "Line";
9003
+ }
9004
+ get toPoint() {
9005
+ const {width: width, rotation: rotation} = this.__;
9006
+ const to = getPointData();
9007
+ if (width) to.x = width;
9008
+ if (rotation) rotate$1(to, rotation);
9009
+ return to;
9010
+ }
9011
+ set toPoint(value) {
9012
+ this.width = getDistance$2(defaultPoint, value);
9013
+ this.rotation = getAngle$1(defaultPoint, value);
9014
+ if (this.height) this.height = 0;
9015
+ }
9016
+ __updatePath() {
9017
+ const data = this.__;
9018
+ const path = data.path = [];
9019
+ if (data.points) {
9020
+ drawPoints(path, data.points, data.curve, data.closed);
9021
+ } else {
9022
+ moveTo(path, 0, 0);
9023
+ lineTo(path, this.width, 0);
9024
+ }
9025
+ }
9026
+ };
9027
+
9028
+ __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9029
+
9030
+ __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9031
+
9032
+ __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9033
+
9034
+ __decorate([ pathType() ], Line.prototype, "points", void 0);
9035
+
9036
+ __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9037
+
9038
+ __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9039
+
9040
+ Line = __decorate([ registerUI() ], Line);
9041
+
9013
9042
  let Image = class Image extends Rect {
9014
9043
  get __tag() {
9015
9044
  return "Image";
@@ -9157,10 +9186,6 @@ let Text = class Text extends UI {
9157
9186
  DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9158
9187
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9159
9188
  }
9160
- __onUpdateSize() {
9161
- if (this.__box) this.__box.__onUpdateSize();
9162
- super.__onUpdateSize();
9163
- }
9164
9189
  __updateRenderSpread() {
9165
9190
  let width = super.__updateRenderSpread();
9166
9191
  if (!width) width = this.isOverflow ? 1 : 0;
@@ -9171,6 +9196,11 @@ let Text = class Text extends UI {
9171
9196
  copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
9172
9197
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
9173
9198
  }
9199
+ __updateChange() {
9200
+ super.__updateChange();
9201
+ const box = this.__box;
9202
+ if (box) box.__onUpdateSize(), box.__updateChange();
9203
+ }
9174
9204
  __drawRenderPath(canvas) {
9175
9205
  canvas.font = this.__.__font;
9176
9206
  }
@@ -10259,12 +10289,18 @@ function shadow(ui, current, shape) {
10259
10289
  }
10260
10290
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
10261
10291
  }
10262
- LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10292
+ if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10263
10293
  if (end && index < end) other.clearWorld(copyBounds);
10264
10294
  });
10265
10295
  other.recycle(copyBounds);
10266
10296
  }
10267
10297
 
10298
+ function getShadowSpread(_ui, shadow) {
10299
+ let width = 0;
10300
+ shadow.forEach(item => width = Math.max(width, Math.max(Math.abs(item.y), Math.abs(item.x)) + (item.spread > 0 ? item.spread : 0) + item.blur * 1.5));
10301
+ return width;
10302
+ }
10303
+
10268
10304
  function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
10269
10305
  const {bounds: bounds, shapeBounds: shapeBounds} = shape;
10270
10306
  if (Platform.fullImageShadow) {
@@ -10342,7 +10378,11 @@ const EffectModule = {
10342
10378
  shadow: shadow,
10343
10379
  innerShadow: innerShadow,
10344
10380
  blur: blur,
10345
- backgroundBlur: backgroundBlur
10381
+ backgroundBlur: backgroundBlur,
10382
+ getShadowSpread: getShadowSpread,
10383
+ isTransformShadow(_shadow) {
10384
+ return undefined;
10385
+ }
10346
10386
  };
10347
10387
 
10348
10388
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
@@ -10850,16 +10890,17 @@ function toTextChar(row) {
10850
10890
  }
10851
10891
 
10852
10892
  function decorationText(drawData, style) {
10853
- let type;
10893
+ let type, offset = 0;
10854
10894
  const {fontSize: fontSize, textDecoration: textDecoration} = style;
10855
10895
  drawData.decorationHeight = fontSize / 11;
10856
10896
  if (isObject(textDecoration)) {
10857
10897
  type = textDecoration.type;
10858
10898
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
10899
+ if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
10859
10900
  } else type = textDecoration;
10860
10901
  switch (type) {
10861
10902
  case "under":
10862
- drawData.decorationY = [ fontSize * .15 ];
10903
+ drawData.decorationY = [ fontSize * .15 + offset ];
10863
10904
  break;
10864
10905
 
10865
10906
  case "delete":
@@ -10867,7 +10908,7 @@ function decorationText(drawData, style) {
10867
10908
  break;
10868
10909
 
10869
10910
  case "under-delete":
10870
- drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
10911
+ drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
10871
10912
  }
10872
10913
  }
10873
10914