@leafer-draw/miniapp 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() {
@@ -7902,8 +7904,6 @@ class TextData extends UIData {
7902
7904
  if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
7903
7905
  box.set(value);
7904
7906
  if (boxLayout.strokeChanged) layout.strokeChange();
7905
- if (boxLayout.renderChanged) layout.renderChange();
7906
- box.__updateChange();
7907
7907
  } else if (box) {
7908
7908
  t.__box = box.parent = null;
7909
7909
  box.destroy();
@@ -7973,7 +7973,7 @@ const UIBounds = {
7973
7973
  __updateRenderSpread() {
7974
7974
  let width = 0;
7975
7975
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
7976
- 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));
7976
+ if (shadow) width = Effect.getShadowSpread(this, shadow);
7977
7977
  if (blur) width = Math.max(width, blur);
7978
7978
  if (filter) width += Filter.getSpread(filter);
7979
7979
  if (renderSpread) width += renderSpread;
@@ -7986,36 +7986,69 @@ const UIBounds = {
7986
7986
  }
7987
7987
  };
7988
7988
 
7989
+ const {float: float} = MathHelper;
7990
+
7991
+ const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
7992
+
7989
7993
  const DragBoundsHelper = {
7994
+ limitMove(leaf, move) {
7995
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
7996
+ if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
7997
+ D.axisMove(leaf, move);
7998
+ },
7999
+ limitScaleOf(leaf, origin, scale) {
8000
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8001
+ if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
8002
+ },
8003
+ axisMove(leaf, move) {
8004
+ const {draggable: draggable} = leaf;
8005
+ if (draggable === "x") move.y = 0;
8006
+ if (draggable === "y") move.x = 0;
8007
+ },
8008
+ getDragBounds(leaf) {
8009
+ const {dragBounds: dragBounds} = leaf;
8010
+ return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
8011
+ },
8012
+ isInnerMode(content, dragBounds, dragBoundsType, sideType) {
8013
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
8014
+ },
7990
8015
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
7991
8016
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
7992
8017
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
7993
8018
  if (!change) move = Object.assign({}, move);
7994
- const isBiggerWidth = content.width > dragBounds.width;
7995
- const isBiggerHeight = content.height > dragBounds.height;
7996
- if (isBiggerWidth && dragBoundsType !== "outer") {
8019
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
7997
8020
  if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
7998
8021
  } else {
7999
8022
  if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
8000
8023
  }
8001
- if (isBiggerHeight && dragBoundsType !== "outer") {
8024
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8002
8025
  if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
8003
8026
  } else {
8004
8027
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
8005
8028
  }
8006
- move.x = MathHelper.float(move.x);
8007
- move.y = MathHelper.float(move.y);
8029
+ move.x = float(move.x);
8030
+ move.y = float(move.y);
8008
8031
  return move;
8009
8032
  },
8010
- axisMove(leaf, move) {
8011
- const {draggable: draggable} = leaf;
8012
- if (draggable === "x") move.y = 0;
8013
- if (draggable === "y") move.x = 0;
8014
- },
8015
- limitMove(leaf, move) {
8016
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8017
- if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
8018
- D.axisMove(leaf, move);
8033
+ getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
8034
+ if (!change) scale = Object.assign({}, scale);
8035
+ let fitScaleX, fitScaleY;
8036
+ tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
8037
+ tempMerge.set(tempContent).add(dragBounds);
8038
+ tempIntersect.set(tempContent).intersect(dragBounds);
8039
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8040
+ fitScaleX = tempMerge.width / tempContent.width;
8041
+ } else {
8042
+ fitScaleX = tempIntersect.width / tempContent.width;
8043
+ }
8044
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8045
+ fitScaleY = tempMerge.height / tempContent.height;
8046
+ } else {
8047
+ fitScaleY = tempIntersect.height / tempContent.height;
8048
+ }
8049
+ scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
8050
+ scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
8051
+ return scale;
8019
8052
  }
8020
8053
  };
8021
8054
 
@@ -8033,7 +8066,7 @@ const UIRender = {
8033
8066
  }
8034
8067
  if (data.__useEffect) {
8035
8068
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8036
- 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"));
8069
+ 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"));
8037
8070
  data.__useEffect = !!(shadow || otherEffect);
8038
8071
  }
8039
8072
  data.__checkSingle();
@@ -8671,7 +8704,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8671
8704
  } else if (attrName === "zIndex") {
8672
8705
  this.canvas.zIndex = newValue;
8673
8706
  setTimeout(() => this.parent && this.parent.__updateSortChildren());
8674
- }
8707
+ } else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
8708
+ mode: newValue
8709
+ });
8675
8710
  }
8676
8711
  return super.__setAttr(attrName, newValue);
8677
8712
  }
@@ -8854,6 +8889,8 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
8854
8889
 
8855
8890
  __decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
8856
8891
 
8892
+ __decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
8893
+
8857
8894
  Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
8858
8895
 
8859
8896
  let Rect = class Rect extends UI {
@@ -9046,57 +9083,9 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
9046
9083
 
9047
9084
  Ellipse = __decorate([ registerUI() ], Ellipse);
9048
9085
 
9049
- const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
9050
-
9051
- const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
9052
-
9053
- let Line = class Line extends UI {
9054
- get __tag() {
9055
- return "Line";
9056
- }
9057
- get toPoint() {
9058
- const {width: width, rotation: rotation} = this.__;
9059
- const to = getPointData();
9060
- if (width) to.x = width;
9061
- if (rotation) rotate$1(to, rotation);
9062
- return to;
9063
- }
9064
- set toPoint(value) {
9065
- this.width = getDistance$2(defaultPoint, value);
9066
- this.rotation = getAngle$1(defaultPoint, value);
9067
- if (this.height) this.height = 0;
9068
- }
9069
- __updatePath() {
9070
- const data = this.__;
9071
- const path = data.path = [];
9072
- if (data.points) {
9073
- drawPoints$1(path, data.points, data.curve, data.closed);
9074
- } else {
9075
- moveTo$2(path, 0, 0);
9076
- lineTo$2(path, this.width, 0);
9077
- }
9078
- }
9079
- };
9080
-
9081
- __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9082
-
9083
- __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9084
-
9085
- __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9086
-
9087
- __decorate([ pathType() ], Line.prototype, "points", void 0);
9088
-
9089
- __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9090
-
9091
- __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9092
-
9093
- Line = __decorate([ registerUI() ], Line);
9094
-
9095
9086
  const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
9096
9087
 
9097
- const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints: drawPoints} = PathCommandDataHelper;
9098
-
9099
- const line = Line.prototype;
9088
+ const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
9100
9089
 
9101
9090
  let Polygon = class Polygon extends UI {
9102
9091
  get __tag() {
@@ -9106,19 +9095,17 @@ let Polygon = class Polygon extends UI {
9106
9095
  const data = this.__;
9107
9096
  const path = data.path = [];
9108
9097
  if (data.points) {
9109
- drawPoints(path, data.points, data.curve, true);
9098
+ drawPoints$1(path, data.points, data.curve, true);
9110
9099
  } else {
9111
9100
  const {width: width, height: height, sides: sides} = data;
9112
9101
  const rx = width / 2, ry = height / 2;
9113
- moveTo$1(path, rx, 0);
9102
+ moveTo$2(path, rx, 0);
9114
9103
  for (let i = 1; i < sides; i++) {
9115
- lineTo$1(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
9104
+ lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
9116
9105
  }
9117
9106
  closePath$1(path);
9118
9107
  }
9119
9108
  }
9120
- __updateRenderPath() {}
9121
- __updateBoxBounds() {}
9122
9109
  };
9123
9110
 
9124
9111
  __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
@@ -9129,15 +9116,11 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9129
9116
 
9130
9117
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
9131
9118
 
9132
- __decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
9133
-
9134
- __decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
9135
-
9136
9119
  Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
9137
9120
 
9138
9121
  const {sin: sin, cos: cos, PI: PI} = Math;
9139
9122
 
9140
- const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
9123
+ const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
9141
9124
 
9142
9125
  let Star = class Star extends UI {
9143
9126
  get __tag() {
@@ -9147,9 +9130,9 @@ let Star = class Star extends UI {
9147
9130
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9148
9131
  const rx = width / 2, ry = height / 2;
9149
9132
  const path = this.__.path = [];
9150
- moveTo(path, rx, 0);
9133
+ moveTo$1(path, rx, 0);
9151
9134
  for (let i = 1; i < corners * 2; i++) {
9152
- lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
9135
+ 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));
9153
9136
  }
9154
9137
  closePath(path);
9155
9138
  }
@@ -9163,6 +9146,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9163
9146
 
9164
9147
  Star = __decorate([ registerUI() ], Star);
9165
9148
 
9149
+ const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
9150
+
9151
+ const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
9152
+
9153
+ let Line = class Line extends UI {
9154
+ get __tag() {
9155
+ return "Line";
9156
+ }
9157
+ get toPoint() {
9158
+ const {width: width, rotation: rotation} = this.__;
9159
+ const to = getPointData();
9160
+ if (width) to.x = width;
9161
+ if (rotation) rotate$1(to, rotation);
9162
+ return to;
9163
+ }
9164
+ set toPoint(value) {
9165
+ this.width = getDistance$2(defaultPoint, value);
9166
+ this.rotation = getAngle$1(defaultPoint, value);
9167
+ if (this.height) this.height = 0;
9168
+ }
9169
+ __updatePath() {
9170
+ const data = this.__;
9171
+ const path = data.path = [];
9172
+ if (data.points) {
9173
+ drawPoints(path, data.points, data.curve, data.closed);
9174
+ } else {
9175
+ moveTo(path, 0, 0);
9176
+ lineTo(path, this.width, 0);
9177
+ }
9178
+ }
9179
+ };
9180
+
9181
+ __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9182
+
9183
+ __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9184
+
9185
+ __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9186
+
9187
+ __decorate([ pathType() ], Line.prototype, "points", void 0);
9188
+
9189
+ __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9190
+
9191
+ __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9192
+
9193
+ Line = __decorate([ registerUI() ], Line);
9194
+
9166
9195
  let Image = class Image extends Rect {
9167
9196
  get __tag() {
9168
9197
  return "Image";
@@ -9310,10 +9339,6 @@ let Text = class Text extends UI {
9310
9339
  DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9311
9340
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9312
9341
  }
9313
- __onUpdateSize() {
9314
- if (this.__box) this.__box.__onUpdateSize();
9315
- super.__onUpdateSize();
9316
- }
9317
9342
  __updateRenderSpread() {
9318
9343
  let width = super.__updateRenderSpread();
9319
9344
  if (!width) width = this.isOverflow ? 1 : 0;
@@ -9324,6 +9349,11 @@ let Text = class Text extends UI {
9324
9349
  copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
9325
9350
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
9326
9351
  }
9352
+ __updateChange() {
9353
+ super.__updateChange();
9354
+ const box = this.__box;
9355
+ if (box) box.__onUpdateSize(), box.__updateChange();
9356
+ }
9327
9357
  __drawRenderPath(canvas) {
9328
9358
  canvas.font = this.__.__font;
9329
9359
  }
@@ -10412,12 +10442,18 @@ function shadow(ui, current, shape) {
10412
10442
  }
10413
10443
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
10414
10444
  }
10415
- LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10445
+ if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10416
10446
  if (end && index < end) other.clearWorld(copyBounds);
10417
10447
  });
10418
10448
  other.recycle(copyBounds);
10419
10449
  }
10420
10450
 
10451
+ function getShadowSpread(_ui, shadow) {
10452
+ let width = 0;
10453
+ 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));
10454
+ return width;
10455
+ }
10456
+
10421
10457
  function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
10422
10458
  const {bounds: bounds, shapeBounds: shapeBounds} = shape;
10423
10459
  if (Platform.fullImageShadow) {
@@ -10495,7 +10531,11 @@ const EffectModule = {
10495
10531
  shadow: shadow,
10496
10532
  innerShadow: innerShadow,
10497
10533
  blur: blur,
10498
- backgroundBlur: backgroundBlur
10534
+ backgroundBlur: backgroundBlur,
10535
+ getShadowSpread: getShadowSpread,
10536
+ isTransformShadow(_shadow) {
10537
+ return undefined;
10538
+ }
10499
10539
  };
10500
10540
 
10501
10541
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
@@ -11003,16 +11043,17 @@ function toTextChar(row) {
11003
11043
  }
11004
11044
 
11005
11045
  function decorationText(drawData, style) {
11006
- let type;
11046
+ let type, offset = 0;
11007
11047
  const {fontSize: fontSize, textDecoration: textDecoration} = style;
11008
11048
  drawData.decorationHeight = fontSize / 11;
11009
11049
  if (isObject(textDecoration)) {
11010
11050
  type = textDecoration.type;
11011
11051
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
11052
+ if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
11012
11053
  } else type = textDecoration;
11013
11054
  switch (type) {
11014
11055
  case "under":
11015
- drawData.decorationY = [ fontSize * .15 ];
11056
+ drawData.decorationY = [ fontSize * .15 + offset ];
11016
11057
  break;
11017
11058
 
11018
11059
  case "delete":
@@ -11020,7 +11061,7 @@ function decorationText(drawData, style) {
11020
11061
  break;
11021
11062
 
11022
11063
  case "under-delete":
11023
- drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
11064
+ drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
11024
11065
  }
11025
11066
  }
11026
11067