leafer-draw 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
  const debug$4 = Debug.get("LeaferCanvas");
6755
6757
 
@@ -7955,8 +7957,6 @@ class TextData extends UIData {
7955
7957
  if (!boxStyle) box.parent = t, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds;
7956
7958
  box.set(value);
7957
7959
  if (boxLayout.strokeChanged) layout.strokeChange();
7958
- if (boxLayout.renderChanged) layout.renderChange();
7959
- box.__updateChange();
7960
7960
  } else if (box) {
7961
7961
  t.__box = box.parent = null;
7962
7962
  box.destroy();
@@ -8026,7 +8026,7 @@ const UIBounds = {
8026
8026
  __updateRenderSpread() {
8027
8027
  let width = 0;
8028
8028
  const {shadow: shadow, innerShadow: innerShadow, blur: blur, backgroundBlur: backgroundBlur, filter: filter, renderSpread: renderSpread} = this.__;
8029
- 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));
8029
+ if (shadow) width = Effect.getShadowSpread(this, shadow);
8030
8030
  if (blur) width = Math.max(width, blur);
8031
8031
  if (filter) width += Filter.getSpread(filter);
8032
8032
  if (renderSpread) width += renderSpread;
@@ -8039,36 +8039,69 @@ const UIBounds = {
8039
8039
  }
8040
8040
  };
8041
8041
 
8042
+ const {float: float} = MathHelper;
8043
+
8044
+ const tempContent = new Bounds, tempMerge = new Bounds, tempIntersect = new Bounds;
8045
+
8042
8046
  const DragBoundsHelper = {
8047
+ limitMove(leaf, move) {
8048
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8049
+ if (dragBounds) D.getValidMove(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, move, true);
8050
+ D.axisMove(leaf, move);
8051
+ },
8052
+ limitScaleOf(leaf, origin, scale) {
8053
+ const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8054
+ if (dragBounds) D.getValidScaleOf(leaf.__localBoxBounds, D.getDragBounds(leaf), dragBoundsType, leaf.getLocalPointByInner(leaf.getInnerPointByBox(origin)), scale, true);
8055
+ },
8056
+ axisMove(leaf, move) {
8057
+ const {draggable: draggable} = leaf;
8058
+ if (draggable === "x") move.y = 0;
8059
+ if (draggable === "y") move.x = 0;
8060
+ },
8061
+ getDragBounds(leaf) {
8062
+ const {dragBounds: dragBounds} = leaf;
8063
+ return dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds;
8064
+ },
8065
+ isInnerMode(content, dragBounds, dragBoundsType, sideType) {
8066
+ return dragBoundsType === "inner" || dragBoundsType === "auto" && content[sideType] > dragBounds[sideType];
8067
+ },
8043
8068
  getValidMove(content, dragBounds, dragBoundsType, move, change) {
8044
8069
  const x = content.x + move.x, y = content.y + move.y, right = x + content.width, bottom = y + content.height;
8045
8070
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
8046
8071
  if (!change) move = Object.assign({}, move);
8047
- const isBiggerWidth = content.width > dragBounds.width;
8048
- const isBiggerHeight = content.height > dragBounds.height;
8049
- if (isBiggerWidth && dragBoundsType !== "outer") {
8072
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8050
8073
  if (x > dragBounds.x) move.x += dragBounds.x - x; else if (right < boundsRight) move.x += boundsRight - right;
8051
8074
  } else {
8052
8075
  if (x < dragBounds.x) move.x += dragBounds.x - x; else if (right > boundsRight) move.x += boundsRight - right;
8053
8076
  }
8054
- if (isBiggerHeight && dragBoundsType !== "outer") {
8077
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8055
8078
  if (y > dragBounds.y) move.y += dragBounds.y - y; else if (bottom < boundsBottom) move.y += boundsBottom - bottom;
8056
8079
  } else {
8057
8080
  if (y < dragBounds.y) move.y += dragBounds.y - y; else if (bottom > boundsBottom) move.y += boundsBottom - bottom;
8058
8081
  }
8059
- move.x = MathHelper.float(move.x);
8060
- move.y = MathHelper.float(move.y);
8082
+ move.x = float(move.x);
8083
+ move.y = float(move.y);
8061
8084
  return move;
8062
8085
  },
8063
- axisMove(leaf, move) {
8064
- const {draggable: draggable} = leaf;
8065
- if (draggable === "x") move.y = 0;
8066
- if (draggable === "y") move.x = 0;
8067
- },
8068
- limitMove(leaf, move) {
8069
- const {dragBounds: dragBounds, dragBoundsType: dragBoundsType} = leaf;
8070
- if (dragBounds) D.getValidMove(leaf.__localBoxBounds, dragBounds === "parent" ? leaf.parent.boxBounds : dragBounds, dragBoundsType, move, true);
8071
- D.axisMove(leaf, move);
8086
+ getValidScaleOf(content, dragBounds, dragBoundsType, origin, scale, change) {
8087
+ if (!change) scale = Object.assign({}, scale);
8088
+ let fitScaleX, fitScaleY;
8089
+ tempContent.set(content).scaleOf(origin, scale.x, scale.y).unsign();
8090
+ tempMerge.set(tempContent).add(dragBounds);
8091
+ tempIntersect.set(tempContent).intersect(dragBounds);
8092
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "width")) {
8093
+ fitScaleX = tempMerge.width / tempContent.width;
8094
+ } else {
8095
+ fitScaleX = tempIntersect.width / tempContent.width;
8096
+ }
8097
+ if (D.isInnerMode(content, dragBounds, dragBoundsType, "height")) {
8098
+ fitScaleY = tempMerge.height / tempContent.height;
8099
+ } else {
8100
+ fitScaleY = tempIntersect.height / tempContent.height;
8101
+ }
8102
+ scale.x = float(tempIntersect.width) ? scale.x * fitScaleX : 1;
8103
+ scale.y = float(tempIntersect.height) ? scale.y * fitScaleY : 1;
8104
+ return scale;
8072
8105
  }
8073
8106
  };
8074
8107
 
@@ -8086,7 +8119,7 @@ const UIRender = {
8086
8119
  }
8087
8120
  if (data.__useEffect) {
8088
8121
  const {shadow: shadow, fill: fill, stroke: stroke} = data, otherEffect = data.innerShadow || data.blur || data.backgroundBlur || data.filter;
8089
- 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"));
8122
+ 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"));
8090
8123
  data.__useEffect = !!(shadow || otherEffect);
8091
8124
  }
8092
8125
  data.__checkSingle();
@@ -8724,7 +8757,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
8724
8757
  } else if (attrName === "zIndex") {
8725
8758
  this.canvas.zIndex = newValue;
8726
8759
  setTimeout(() => this.parent && this.parent.__updateSortChildren());
8727
- }
8760
+ } else if (attrName === "mode") this.emit(LeaferEvent.UPDATE_MODE, {
8761
+ mode: newValue
8762
+ });
8728
8763
  }
8729
8764
  return super.__setAttr(attrName, newValue);
8730
8765
  }
@@ -8907,6 +8942,8 @@ __decorate([ dataProcessor(LeaferData) ], Leafer.prototype, "__", void 0);
8907
8942
 
8908
8943
  __decorate([ boundsType() ], Leafer.prototype, "pixelRatio", void 0);
8909
8944
 
8945
+ __decorate([ dataType("normal") ], Leafer.prototype, "mode", void 0);
8946
+
8910
8947
  Leafer = Leafer_1 = __decorate([ registerUI() ], Leafer);
8911
8948
 
8912
8949
  let Rect = class Rect extends UI {
@@ -9099,57 +9136,9 @@ __decorate([ pathType(0) ], Ellipse.prototype, "endAngle", void 0);
9099
9136
 
9100
9137
  Ellipse = __decorate([ registerUI() ], Ellipse);
9101
9138
 
9102
- const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathCommandDataHelper;
9103
-
9104
- const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
9105
-
9106
- let Line = class Line extends UI {
9107
- get __tag() {
9108
- return "Line";
9109
- }
9110
- get toPoint() {
9111
- const {width: width, rotation: rotation} = this.__;
9112
- const to = getPointData();
9113
- if (width) to.x = width;
9114
- if (rotation) rotate$1(to, rotation);
9115
- return to;
9116
- }
9117
- set toPoint(value) {
9118
- this.width = getDistance$2(defaultPoint, value);
9119
- this.rotation = getAngle$1(defaultPoint, value);
9120
- if (this.height) this.height = 0;
9121
- }
9122
- __updatePath() {
9123
- const data = this.__;
9124
- const path = data.path = [];
9125
- if (data.points) {
9126
- drawPoints$1(path, data.points, data.curve, data.closed);
9127
- } else {
9128
- moveTo$2(path, 0, 0);
9129
- lineTo$2(path, this.width, 0);
9130
- }
9131
- }
9132
- };
9133
-
9134
- __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9135
-
9136
- __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9137
-
9138
- __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9139
-
9140
- __decorate([ pathType() ], Line.prototype, "points", void 0);
9141
-
9142
- __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9143
-
9144
- __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9145
-
9146
- Line = __decorate([ registerUI() ], Line);
9147
-
9148
9139
  const {sin: sin$1, cos: cos$1, PI: PI$1} = Math;
9149
9140
 
9150
- const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath$1, drawPoints: drawPoints} = PathCommandDataHelper;
9151
-
9152
- const line = Line.prototype;
9141
+ const {moveTo: moveTo$2, lineTo: lineTo$2, closePath: closePath$1, drawPoints: drawPoints$1} = PathCommandDataHelper;
9153
9142
 
9154
9143
  let Polygon = class Polygon extends UI {
9155
9144
  get __tag() {
@@ -9159,19 +9148,17 @@ let Polygon = class Polygon extends UI {
9159
9148
  const data = this.__;
9160
9149
  const path = data.path = [];
9161
9150
  if (data.points) {
9162
- drawPoints(path, data.points, data.curve, true);
9151
+ drawPoints$1(path, data.points, data.curve, true);
9163
9152
  } else {
9164
9153
  const {width: width, height: height, sides: sides} = data;
9165
9154
  const rx = width / 2, ry = height / 2;
9166
- moveTo$1(path, rx, 0);
9155
+ moveTo$2(path, rx, 0);
9167
9156
  for (let i = 1; i < sides; i++) {
9168
- lineTo$1(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
9157
+ lineTo$2(path, rx + rx * sin$1(i * 2 * PI$1 / sides), ry - ry * cos$1(i * 2 * PI$1 / sides));
9169
9158
  }
9170
9159
  closePath$1(path);
9171
9160
  }
9172
9161
  }
9173
- __updateRenderPath() {}
9174
- __updateBoxBounds() {}
9175
9162
  };
9176
9163
 
9177
9164
  __decorate([ dataProcessor(PolygonData) ], Polygon.prototype, "__", void 0);
@@ -9182,15 +9169,11 @@ __decorate([ pathType() ], Polygon.prototype, "points", void 0);
9182
9169
 
9183
9170
  __decorate([ pathType(0) ], Polygon.prototype, "curve", void 0);
9184
9171
 
9185
- __decorate([ rewrite(line.__updateRenderPath) ], Polygon.prototype, "__updateRenderPath", null);
9186
-
9187
- __decorate([ rewrite(line.__updateBoxBounds) ], Polygon.prototype, "__updateBoxBounds", null);
9188
-
9189
9172
  Polygon = __decorate([ rewriteAble(), registerUI() ], Polygon);
9190
9173
 
9191
9174
  const {sin: sin, cos: cos, PI: PI} = Math;
9192
9175
 
9193
- const {moveTo: moveTo, lineTo: lineTo, closePath: closePath} = PathCommandDataHelper;
9176
+ const {moveTo: moveTo$1, lineTo: lineTo$1, closePath: closePath} = PathCommandDataHelper;
9194
9177
 
9195
9178
  let Star = class Star extends UI {
9196
9179
  get __tag() {
@@ -9200,9 +9183,9 @@ let Star = class Star extends UI {
9200
9183
  const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
9201
9184
  const rx = width / 2, ry = height / 2;
9202
9185
  const path = this.__.path = [];
9203
- moveTo(path, rx, 0);
9186
+ moveTo$1(path, rx, 0);
9204
9187
  for (let i = 1; i < corners * 2; i++) {
9205
- lineTo(path, rx + (i % 2 === 0 ? rx : rx * innerRadius) * sin(i * PI / corners), ry - (i % 2 === 0 ? ry : ry * innerRadius) * cos(i * PI / corners));
9188
+ 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));
9206
9189
  }
9207
9190
  closePath(path);
9208
9191
  }
@@ -9216,6 +9199,52 @@ __decorate([ pathType(.382) ], Star.prototype, "innerRadius", void 0);
9216
9199
 
9217
9200
  Star = __decorate([ registerUI() ], Star);
9218
9201
 
9202
+ const {moveTo: moveTo, lineTo: lineTo, drawPoints: drawPoints} = PathCommandDataHelper;
9203
+
9204
+ const {rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint: defaultPoint} = PointHelper;
9205
+
9206
+ let Line = class Line extends UI {
9207
+ get __tag() {
9208
+ return "Line";
9209
+ }
9210
+ get toPoint() {
9211
+ const {width: width, rotation: rotation} = this.__;
9212
+ const to = getPointData();
9213
+ if (width) to.x = width;
9214
+ if (rotation) rotate$1(to, rotation);
9215
+ return to;
9216
+ }
9217
+ set toPoint(value) {
9218
+ this.width = getDistance$2(defaultPoint, value);
9219
+ this.rotation = getAngle$1(defaultPoint, value);
9220
+ if (this.height) this.height = 0;
9221
+ }
9222
+ __updatePath() {
9223
+ const data = this.__;
9224
+ const path = data.path = [];
9225
+ if (data.points) {
9226
+ drawPoints(path, data.points, data.curve, data.closed);
9227
+ } else {
9228
+ moveTo(path, 0, 0);
9229
+ lineTo(path, this.width, 0);
9230
+ }
9231
+ }
9232
+ };
9233
+
9234
+ __decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
9235
+
9236
+ __decorate([ affectStrokeBoundsType("center") ], Line.prototype, "strokeAlign", void 0);
9237
+
9238
+ __decorate([ boundsType(0) ], Line.prototype, "height", void 0);
9239
+
9240
+ __decorate([ pathType() ], Line.prototype, "points", void 0);
9241
+
9242
+ __decorate([ pathType(0) ], Line.prototype, "curve", void 0);
9243
+
9244
+ __decorate([ pathType(false) ], Line.prototype, "closed", void 0);
9245
+
9246
+ Line = __decorate([ registerUI() ], Line);
9247
+
9219
9248
  let Image$1 = class Image extends Rect {
9220
9249
  get __tag() {
9221
9250
  return "Image";
@@ -9363,10 +9392,6 @@ let Text = class Text extends UI {
9363
9392
  DataHelper.stintSet(this, "isOverflow", !includes(b, contentBounds));
9364
9393
  if (this.isOverflow) setList(data.__textBoxBounds = {}, [ b, contentBounds ]), layout.renderChanged = true; else data.__textBoxBounds = b;
9365
9394
  }
9366
- __onUpdateSize() {
9367
- if (this.__box) this.__box.__onUpdateSize();
9368
- super.__onUpdateSize();
9369
- }
9370
9395
  __updateRenderSpread() {
9371
9396
  let width = super.__updateRenderSpread();
9372
9397
  if (!width) width = this.isOverflow ? 1 : 0;
@@ -9377,6 +9402,11 @@ let Text = class Text extends UI {
9377
9402
  copyAndSpread(renderBounds, this.__.__textBoxBounds, renderSpread);
9378
9403
  if (this.__box) this.__box.__layout.renderBounds = renderBounds;
9379
9404
  }
9405
+ __updateChange() {
9406
+ super.__updateChange();
9407
+ const box = this.__box;
9408
+ if (box) box.__onUpdateSize(), box.__updateChange();
9409
+ }
9380
9410
  __drawRenderPath(canvas) {
9381
9411
  canvas.font = this.__.__font;
9382
9412
  }
@@ -10465,12 +10495,18 @@ function shadow(ui, current, shape) {
10465
10495
  }
10466
10496
  worldCanvas ? other.copyWorld(worldCanvas, nowWorld, nowWorld, "destination-out") : other.copyWorld(shape.canvas, shapeBounds, bounds, "destination-out");
10467
10497
  }
10468
- LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10498
+ if (Effect.isTransformShadow(item)) Effect.renderTransformShadow(ui, current, other, copyBounds, item); else LeafHelper.copyCanvasByWorld(ui, current, other, copyBounds, item.blendMode);
10469
10499
  if (end && index < end) other.clearWorld(copyBounds);
10470
10500
  });
10471
10501
  other.recycle(copyBounds);
10472
10502
  }
10473
10503
 
10504
+ function getShadowSpread(_ui, shadow) {
10505
+ let width = 0;
10506
+ 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));
10507
+ return width;
10508
+ }
10509
+
10474
10510
  function drawWorldShadow(canvas, outBounds, spreadScale, shape) {
10475
10511
  const {bounds: bounds, shapeBounds: shapeBounds} = shape;
10476
10512
  if (Platform.fullImageShadow) {
@@ -10548,7 +10584,11 @@ const EffectModule = {
10548
10584
  shadow: shadow,
10549
10585
  innerShadow: innerShadow,
10550
10586
  blur: blur,
10551
- backgroundBlur: backgroundBlur
10587
+ backgroundBlur: backgroundBlur,
10588
+ getShadowSpread: getShadowSpread,
10589
+ isTransformShadow(_shadow) {
10590
+ return undefined;
10591
+ }
10552
10592
  };
10553
10593
 
10554
10594
  const {excludeRenderBounds: excludeRenderBounds} = LeafBoundsHelper;
@@ -11056,16 +11096,17 @@ function toTextChar(row) {
11056
11096
  }
11057
11097
 
11058
11098
  function decorationText(drawData, style) {
11059
- let type;
11099
+ let type, offset = 0;
11060
11100
  const {fontSize: fontSize, textDecoration: textDecoration} = style;
11061
11101
  drawData.decorationHeight = fontSize / 11;
11062
11102
  if (isObject(textDecoration)) {
11063
11103
  type = textDecoration.type;
11064
11104
  if (textDecoration.color) drawData.decorationColor = ColorConvert.string(textDecoration.color);
11105
+ if (textDecoration.offset) offset = Math.min(fontSize * .3, Math.max(textDecoration.offset, -fontSize * .15));
11065
11106
  } else type = textDecoration;
11066
11107
  switch (type) {
11067
11108
  case "under":
11068
- drawData.decorationY = [ fontSize * .15 ];
11109
+ drawData.decorationY = [ fontSize * .15 + offset ];
11069
11110
  break;
11070
11111
 
11071
11112
  case "delete":
@@ -11073,7 +11114,7 @@ function decorationText(drawData, style) {
11073
11114
  break;
11074
11115
 
11075
11116
  case "under-delete":
11076
- drawData.decorationY = [ fontSize * .15, -fontSize * .35 ];
11117
+ drawData.decorationY = [ fontSize * .15 + offset, -fontSize * .35 ];
11077
11118
  }
11078
11119
  }
11079
11120