@leafer-ui/worker 1.0.9 → 1.1.0

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.
@@ -108,7 +108,7 @@ const MathHelper = {
108
108
  return rotation - oldRotation;
109
109
  },
110
110
  float(num, maxLength) {
111
- const a = maxLength ? pow$1(10, maxLength) : 1000000000000;
111
+ const a = maxLength !== undefined ? pow$1(10, maxLength) : 1000000000000;
112
112
  num = round(num * a) / a;
113
113
  return num === -0 ? 0 : num;
114
114
  },
@@ -1411,14 +1411,13 @@ const UICreator = {
1411
1411
  list: {},
1412
1412
  register(UI) {
1413
1413
  const { __tag: tag } = UI.prototype;
1414
- if (list$2[tag]) {
1414
+ if (list$2[tag])
1415
1415
  debug$e.repeat(tag);
1416
- }
1417
- else {
1418
- list$2[tag] = UI;
1419
- }
1416
+ list$2[tag] = UI;
1420
1417
  },
1421
1418
  get(tag, data, x, y, width, height) {
1419
+ if (!list$2[tag])
1420
+ debug$e.error('not register ' + tag);
1422
1421
  const ui = new list$2[tag](data);
1423
1422
  if (x !== undefined) {
1424
1423
  ui.x = x;
@@ -1442,7 +1441,7 @@ const EventCreator = {
1442
1441
  Object.keys(Event).forEach(key => {
1443
1442
  name = Event[key];
1444
1443
  if (typeof name === 'string')
1445
- nameList[name] ? debug$d.repeat(name) : nameList[name] = Event;
1444
+ nameList[name] && debug$d.repeat(name), nameList[name] = Event;
1446
1445
  });
1447
1446
  },
1448
1447
  changeName(oldName, newName) {
@@ -1644,7 +1643,7 @@ class LeafData {
1644
1643
  const t = this;
1645
1644
  if (t.blendMode === 'pass-through') {
1646
1645
  const leaf = this.__leaf;
1647
- if ((t.opacity < 1 && leaf.isBranch) || leaf.__hasEraser || t.eraser) {
1646
+ if ((t.opacity < 1 && (leaf.isBranch || t.__hasMultiPaint)) || leaf.__hasEraser || t.eraser) {
1648
1647
  t.__single = true;
1649
1648
  }
1650
1649
  else if (t.__single) {
@@ -2042,8 +2041,9 @@ class LeaferCanvasBase extends Canvas$1 {
2042
2041
  takeCanvas = this.getSameCanvas();
2043
2042
  takeCanvas.copyWorld(this);
2044
2043
  }
2045
- DataHelper.copyAttrs(this.size, size, canvasSizeAttrs);
2046
- this.size.pixelRatio || (this.size.pixelRatio = 1);
2044
+ const s = this.size;
2045
+ DataHelper.copyAttrs(s, size, canvasSizeAttrs);
2046
+ canvasSizeAttrs.forEach(key => s[key] || (s[key] = 1));
2047
2047
  this.bounds = new Bounds(0, 0, this.width, this.height);
2048
2048
  if (this.context && !this.unreal) {
2049
2049
  this.updateViewSize();
@@ -2157,6 +2157,17 @@ class LeaferCanvasBase extends Canvas$1 {
2157
2157
  if (!onlyResetTransform)
2158
2158
  this.useWorldTransform();
2159
2159
  }
2160
+ useGrayscaleAlpha(bounds) {
2161
+ this.setTempBounds(bounds, true, true);
2162
+ let alpha, pixel;
2163
+ const { context } = this, imageData = context.getImageData(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height), { data } = imageData;
2164
+ for (let i = 0, len = data.length; i < len; i += 4) {
2165
+ pixel = data[i] * 0.299 + data[i + 1] * 0.587 + data[i + 2] * 0.114;
2166
+ if (alpha = data[i + 3])
2167
+ data[i + 3] = alpha === 255 ? pixel : alpha * (pixel / 255);
2168
+ }
2169
+ context.putImageData(imageData, tempBounds$1.x, tempBounds$1.y);
2170
+ }
2160
2171
  useMask(maskCanvas, fromBounds, toBounds) {
2161
2172
  this.copyWorld(maskCanvas, fromBounds, toBounds, 'destination-in');
2162
2173
  }
@@ -2167,7 +2178,7 @@ class LeaferCanvasBase extends Canvas$1 {
2167
2178
  if (blendMode)
2168
2179
  this.blendMode = blendMode;
2169
2180
  this.fillStyle = color;
2170
- tempBounds$1.set(bounds).scale(this.pixelRatio);
2181
+ this.setTempBounds(bounds);
2171
2182
  this.fillRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2172
2183
  if (blendMode)
2173
2184
  this.blendMode = 'source-over';
@@ -2176,22 +2187,18 @@ class LeaferCanvasBase extends Canvas$1 {
2176
2187
  if (blendMode)
2177
2188
  this.blendMode = blendMode;
2178
2189
  this.strokeStyle = color;
2179
- tempBounds$1.set(bounds).scale(this.pixelRatio);
2190
+ this.setTempBounds(bounds);
2180
2191
  this.strokeRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2181
2192
  if (blendMode)
2182
2193
  this.blendMode = 'source-over';
2183
2194
  }
2184
2195
  clearWorld(bounds, ceilPixel) {
2185
- tempBounds$1.set(bounds).scale(this.pixelRatio);
2186
- if (ceilPixel)
2187
- tempBounds$1.ceil();
2196
+ this.setTempBounds(bounds, ceilPixel);
2188
2197
  this.clearRect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2189
2198
  }
2190
2199
  clipWorld(bounds, ceilPixel) {
2191
2200
  this.beginPath();
2192
- tempBounds$1.set(bounds).scale(this.pixelRatio);
2193
- if (ceilPixel)
2194
- tempBounds$1.ceil();
2201
+ this.setTempBounds(bounds, ceilPixel);
2195
2202
  this.rect(tempBounds$1.x, tempBounds$1.y, tempBounds$1.width, tempBounds$1.height);
2196
2203
  this.clip();
2197
2204
  }
@@ -2199,6 +2206,14 @@ class LeaferCanvasBase extends Canvas$1 {
2199
2206
  const { pixelRatio } = this;
2200
2207
  this.clearRect(0, 0, this.width * pixelRatio + 2, this.height * pixelRatio + 2);
2201
2208
  }
2209
+ setTempBounds(bounds, ceil, intersect) {
2210
+ tempBounds$1.set(bounds);
2211
+ if (intersect)
2212
+ tempBounds$1.intersect(this.bounds);
2213
+ tempBounds$1.scale(this.pixelRatio);
2214
+ if (ceil)
2215
+ tempBounds$1.ceil();
2216
+ }
2202
2217
  isSameSize(size) {
2203
2218
  return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
2204
2219
  }
@@ -4150,20 +4165,17 @@ const LeafHelper = {
4150
4165
  }
4151
4166
  return true;
4152
4167
  },
4153
- moveWorld(t, x, y = 0, isInnerPoint) {
4168
+ moveWorld(t, x, y = 0, isInnerPoint, transition) {
4154
4169
  const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
4155
4170
  isInnerPoint ? toOuterPoint$1(t.localTransform, local, local, true) : (t.parent && toInnerPoint$1(t.parent.worldTransform, local, local, true));
4156
- L.moveLocal(t, local.x, local.y);
4171
+ L.moveLocal(t, local.x, local.y, transition);
4157
4172
  },
4158
- moveLocal(t, x, y = 0) {
4159
- if (typeof x === 'object') {
4160
- t.x += x.x;
4161
- t.y += x.y;
4162
- }
4163
- else {
4164
- t.x += x;
4165
- t.y += y;
4166
- }
4173
+ moveLocal(t, x, y = 0, transition) {
4174
+ if (typeof x === 'object')
4175
+ y = x.y, x = x.x;
4176
+ x += t.x;
4177
+ y += t.y;
4178
+ transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y);
4167
4179
  },
4168
4180
  zoomOfWorld(t, origin, scaleX, scaleY, resize) {
4169
4181
  L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
@@ -5212,13 +5224,14 @@ const BranchRender = {
5212
5224
  this.__.__checkSingle();
5213
5225
  },
5214
5226
  __render(canvas, options) {
5227
+ this.__nowWorld = this.__getNowWorld(options);
5215
5228
  if (this.__worldOpacity) {
5216
5229
  if (this.__.__single) {
5217
5230
  if (this.__.eraser === 'path')
5218
5231
  return this.__renderEraser(canvas, options);
5219
5232
  const tempCanvas = canvas.getSameCanvas(false, true);
5220
5233
  this.__renderBranch(tempCanvas, options);
5221
- const nowWorld = this.__getNowWorld(options);
5234
+ const nowWorld = this.__nowWorld;
5222
5235
  canvas.opacity = this.__.opacity;
5223
5236
  canvas.copyWorldByReset(tempCanvas, nowWorld, nowWorld, this.__.__blendMode, true);
5224
5237
  tempCanvas.recycle(nowWorld);
@@ -5542,11 +5555,11 @@ let Leaf = class Leaf {
5542
5555
  transform(matrix, resize) {
5543
5556
  transform(this, matrix, resize);
5544
5557
  }
5545
- move(x, y) {
5546
- moveLocal(this, x, y);
5558
+ move(x, y, transition) {
5559
+ moveLocal(this, x, y, transition);
5547
5560
  }
5548
- moveInner(x, y) {
5549
- moveWorld(this, x, y, true);
5561
+ moveInner(x, y, transition) {
5562
+ moveWorld(this, x, y, true, transition);
5550
5563
  }
5551
5564
  scaleOf(origin, scaleX, scaleY, resize) {
5552
5565
  zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
@@ -5560,8 +5573,8 @@ let Leaf = class Leaf {
5560
5573
  transformWorld(worldTransform, resize) {
5561
5574
  transformWorld(this, worldTransform, resize);
5562
5575
  }
5563
- moveWorld(x, y) {
5564
- moveWorld(this, x, y);
5576
+ moveWorld(x, y, transition) {
5577
+ moveWorld(this, x, y, false, transition);
5565
5578
  }
5566
5579
  scaleOfWorld(worldOrigin, scaleX, scaleY, resize) {
5567
5580
  zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize);
@@ -5959,7 +5972,7 @@ class LeafLevelList {
5959
5972
  }
5960
5973
  }
5961
5974
 
5962
- const version = "1.0.9";
5975
+ const version = "1.1.0";
5963
5976
 
5964
5977
  class LeaferCanvas extends LeaferCanvasBase {
5965
5978
  get allowBackgroundColor() { return true; }
@@ -6428,7 +6441,8 @@ class Renderer {
6428
6441
  this.totalBounds = new Bounds();
6429
6442
  debug$5.log(target.innerName, '--->');
6430
6443
  try {
6431
- target.app.emit(RenderEvent.CHILD_START, target);
6444
+ if (!target.isApp)
6445
+ target.app.emit(RenderEvent.CHILD_START, target);
6432
6446
  this.emitRender(RenderEvent.START);
6433
6447
  this.renderOnce(callback);
6434
6448
  this.emitRender(RenderEvent.END, this.totalBounds);
@@ -6982,6 +6996,12 @@ class UIData extends LeafData {
6982
6996
  return strokeWidth;
6983
6997
  }
6984
6998
  get __hasStroke() { return this.stroke && this.strokeWidth; }
6999
+ get __hasMultiPaint() {
7000
+ const t = this;
7001
+ if ((t.__isFills && t.fill.length > 1) || (t.__isStrokes && t.stroke.length > 1) || t.__useEffect)
7002
+ return true;
7003
+ return t.fill && this.__hasStroke;
7004
+ }
6985
7005
  get __clipAfterFill() { return (this.cornerRadius || this.__pathInputed); }
6986
7006
  get __autoWidth() { return !this._width; }
6987
7007
  get __autoHeight() { return !this._height; }
@@ -7351,9 +7371,8 @@ const RectRender = {
7351
7371
  canvas.strokeRect(half, half, width, height);
7352
7372
  canvas.restore();
7353
7373
  }
7354
- else {
7374
+ else
7355
7375
  canvas.strokeRect(half, half, width, height);
7356
- }
7357
7376
  break;
7358
7377
  case 'outside':
7359
7378
  canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
@@ -7383,11 +7402,15 @@ let UI = UI_1 = class UI extends Leaf {
7383
7402
  super(data);
7384
7403
  }
7385
7404
  reset(_data) { }
7386
- set(data, isTemp) {
7387
- if (isTemp) {
7388
- this.lockNormalStyle = true;
7389
- Object.assign(this, data);
7390
- this.lockNormalStyle = false;
7405
+ set(data, transition) {
7406
+ if (transition) {
7407
+ if (transition === 'temp') {
7408
+ this.lockNormalStyle = true;
7409
+ Object.assign(this, data);
7410
+ this.lockNormalStyle = false;
7411
+ }
7412
+ else
7413
+ this.animate(data, transition);
7391
7414
  }
7392
7415
  else
7393
7416
  Object.assign(this, data);
@@ -7578,6 +7601,15 @@ __decorate([
7578
7601
  __decorate([
7579
7602
  boundsType(0)
7580
7603
  ], UI.prototype, "padding", void 0);
7604
+ __decorate([
7605
+ boundsType(false)
7606
+ ], UI.prototype, "lockRatio", void 0);
7607
+ __decorate([
7608
+ boundsType()
7609
+ ], UI.prototype, "widthRange", void 0);
7610
+ __decorate([
7611
+ boundsType()
7612
+ ], UI.prototype, "heightRange", void 0);
7581
7613
  __decorate([
7582
7614
  dataType(false)
7583
7615
  ], UI.prototype, "draggable", void 0);
@@ -7688,17 +7720,17 @@ let Group = class Group extends UI {
7688
7720
  if (!this.children)
7689
7721
  this.children = [];
7690
7722
  }
7691
- set(data, isTemp) {
7723
+ set(data, transition) {
7692
7724
  if (data.children) {
7693
7725
  const { children } = data;
7694
7726
  delete data.children;
7695
7727
  this.children ? this.clear() : this.__setBranch();
7696
- super.set(data, isTemp);
7728
+ super.set(data, transition);
7697
7729
  children.forEach(child => this.add(child));
7698
7730
  data.children = children;
7699
7731
  }
7700
7732
  else
7701
- super.set(data, isTemp);
7733
+ super.set(data, transition);
7702
7734
  }
7703
7735
  toJSON(options) {
7704
7736
  const data = super.toJSON(options);
@@ -7811,8 +7843,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7811
7843
  }
7812
7844
  onInit() { }
7813
7845
  initType(_type) { }
7814
- set(data) {
7815
- this.waitInit(() => { super.set(data); });
7846
+ set(data, transition) {
7847
+ this.waitInit(() => { super.set(data, transition); });
7816
7848
  }
7817
7849
  start() {
7818
7850
  clearTimeout(this.__startTimer);
@@ -7869,8 +7901,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
7869
7901
  __onResize(event) {
7870
7902
  this.emitEvent(event);
7871
7903
  DataHelper.copyAttrs(this.__, event, canvasSizeAttrs);
7872
- if (!event.width || !event.height)
7873
- debug$3.warn('w = 0 or h = 0');
7874
7904
  setTimeout(() => { if (this.canvasManager)
7875
7905
  this.canvasManager.clearRecycled(); }, 0);
7876
7906
  }
@@ -8195,9 +8225,6 @@ __decorate([
8195
8225
  __decorate([
8196
8226
  dataType(false)
8197
8227
  ], Box.prototype, "resizeChildren", void 0);
8198
- __decorate([
8199
- dataType(false)
8200
- ], Box.prototype, "textBox", void 0);
8201
8228
  __decorate([
8202
8229
  affectRenderBoundsType('show')
8203
8230
  ], Box.prototype, "overflow", void 0);
@@ -8952,19 +8979,13 @@ class UIEvent extends Event {
8952
8979
  Object.assign(this, params);
8953
8980
  }
8954
8981
  getBoxPoint(relative) {
8955
- if (!relative)
8956
- relative = this.current;
8957
- return relative.getBoxPoint(this);
8982
+ return (relative || this.current).getBoxPoint(this);
8958
8983
  }
8959
8984
  getInnerPoint(relative) {
8960
- if (!relative)
8961
- relative = this.current;
8962
- return relative.getInnerPoint(this);
8985
+ return (relative || this.current).getInnerPoint(this);
8963
8986
  }
8964
8987
  getLocalPoint(relative) {
8965
- if (!relative)
8966
- relative = this.current;
8967
- return relative.getLocalPoint(this);
8988
+ return (relative || this.current).getLocalPoint(this);
8968
8989
  }
8969
8990
  getPagePoint() {
8970
8991
  return this.current.getPagePoint(this);
@@ -9012,10 +9033,8 @@ let DragEvent = class DragEvent extends PointerEvent {
9012
9033
  this.data = data;
9013
9034
  }
9014
9035
  static getValidMove(leaf, start, total) {
9015
- const { draggable, dragBounds, x, y } = leaf;
9016
- const move = leaf.getLocalPoint(total, null, true);
9017
- move.x += start.x - x;
9018
- move.y += start.y - y;
9036
+ const { draggable, dragBounds } = leaf, move = leaf.getLocalPoint(total, null, true);
9037
+ PointHelper.move(move, start.x - leaf.x, start.y - leaf.y);
9019
9038
  if (dragBounds)
9020
9039
  this.getMoveInDragBounds(leaf.__local, dragBounds === 'parent' ? leaf.parent.boxBounds : dragBounds, move, true);
9021
9040
  if (draggable === 'x')
@@ -9025,8 +9044,7 @@ let DragEvent = class DragEvent extends PointerEvent {
9025
9044
  return move;
9026
9045
  }
9027
9046
  static getMoveInDragBounds(childBox, dragBounds, move, change) {
9028
- const x = childBox.x + move.x, y = childBox.y + move.y;
9029
- const right = x + childBox.width, bottom = y + childBox.height;
9047
+ const x = childBox.x + move.x, y = childBox.y + move.y, right = x + childBox.width, bottom = y + childBox.height;
9030
9048
  const boundsRight = dragBounds.x + dragBounds.width, boundsBottom = dragBounds.y + dragBounds.height;
9031
9049
  if (!change)
9032
9050
  move = Object.assign({}, move);
@@ -9078,9 +9096,7 @@ let DragEvent = class DragEvent extends PointerEvent {
9078
9096
  return this.getLocalMove(relative, true);
9079
9097
  }
9080
9098
  getPageBounds() {
9081
- const total = this.getPageTotal();
9082
- const start = this.getPagePoint();
9083
- const bounds = {};
9099
+ const total = this.getPageTotal(), start = this.getPagePoint(), bounds = {};
9084
9100
  BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
9085
9101
  BoundsHelper.unsign(bounds);
9086
9102
  return bounds;
@@ -9198,7 +9214,8 @@ const debug$2 = Debug.get('LeaferTypeCreator');
9198
9214
  const LeaferTypeCreator = {
9199
9215
  list: {},
9200
9216
  register(name, fn) {
9201
- list[name] ? debug$2.repeat(name) : list[name] = fn;
9217
+ list[name] && debug$2.repeat(name);
9218
+ list[name] = fn;
9202
9219
  },
9203
9220
  run(name, leafer) {
9204
9221
  const fn = list[name];
@@ -10467,6 +10484,8 @@ function stroke(stroke, ui, canvas) {
10467
10484
  case 'center':
10468
10485
  canvas.setStroke(stroke, __strokeWidth, options);
10469
10486
  canvas.stroke();
10487
+ if (options.__useArrow)
10488
+ strokeArrow(ui, canvas);
10470
10489
  break;
10471
10490
  case 'inside':
10472
10491
  canvas.save();
@@ -10504,6 +10523,8 @@ function strokes(strokes, ui, canvas) {
10504
10523
  case 'center':
10505
10524
  canvas.setStroke(undefined, __strokeWidth, options);
10506
10525
  drawStrokesStyle(strokes, false, ui, canvas);
10526
+ if (options.__useArrow)
10527
+ strokeArrow(ui, canvas);
10507
10528
  break;
10508
10529
  case 'inside':
10509
10530
  canvas.save();
@@ -10529,6 +10550,14 @@ function strokes(strokes, ui, canvas) {
10529
10550
  }
10530
10551
  }
10531
10552
  }
10553
+ function strokeArrow(ui, canvas) {
10554
+ if (ui.__.dashPattern) {
10555
+ canvas.beginPath();
10556
+ ui.__drawPathByData(canvas, ui.__.__pathForArrow);
10557
+ canvas.dashPattern = null;
10558
+ canvas.stroke();
10559
+ }
10560
+ }
10532
10561
 
10533
10562
  const { getSpread, getOuterOf, getByMove, getIntersectData } = BoundsHelper;
10534
10563
  function shape(ui, current, options) {
@@ -11214,16 +11243,16 @@ const EffectModule = {
11214
11243
 
11215
11244
  const { excludeRenderBounds } = LeafBoundsHelper;
11216
11245
  Group.prototype.__renderMask = function (canvas, options) {
11217
- let child, maskCanvas, contentCanvas, maskOpacity, currentMask;
11246
+ let child, maskCanvas, contentCanvas, maskOpacity, currentMask, mask;
11218
11247
  const { children } = this;
11219
11248
  for (let i = 0, len = children.length; i < len; i++) {
11220
- child = children[i];
11221
- if (child.__.mask) {
11249
+ child = children[i], mask = child.__.mask;
11250
+ if (mask) {
11222
11251
  if (currentMask) {
11223
11252
  maskEnd(this, currentMask, canvas, contentCanvas, maskCanvas, maskOpacity);
11224
11253
  maskCanvas = contentCanvas = null;
11225
11254
  }
11226
- if (child.__.mask === 'path') {
11255
+ if (mask === 'path' || mask === 'clipping-path') {
11227
11256
  if (child.opacity < 1) {
11228
11257
  currentMask = 'opacity-path';
11229
11258
  maskOpacity = child.opacity;
@@ -11237,14 +11266,14 @@ Group.prototype.__renderMask = function (canvas, options) {
11237
11266
  child.__clip(contentCanvas || canvas, options);
11238
11267
  }
11239
11268
  else {
11240
- currentMask = 'alpha';
11269
+ currentMask = mask === 'grayscale' ? 'grayscale' : 'alpha';
11241
11270
  if (!maskCanvas)
11242
11271
  maskCanvas = getCanvas(canvas);
11243
11272
  if (!contentCanvas)
11244
11273
  contentCanvas = getCanvas(canvas);
11245
11274
  child.__render(maskCanvas, options);
11246
11275
  }
11247
- if (child.__.mask !== 'clipping')
11276
+ if (!(mask === 'clipping' || mask === 'clipping-path'))
11248
11277
  continue;
11249
11278
  }
11250
11279
  if (excludeRenderBounds(child, options))
@@ -11255,6 +11284,8 @@ Group.prototype.__renderMask = function (canvas, options) {
11255
11284
  };
11256
11285
  function maskEnd(leaf, maskMode, canvas, contentCanvas, maskCanvas, maskOpacity) {
11257
11286
  switch (maskMode) {
11287
+ case 'grayscale':
11288
+ maskCanvas.useGrayscaleAlpha(leaf.__nowWorld);
11258
11289
  case 'alpha':
11259
11290
  usePixelMask(leaf, canvas, contentCanvas, maskCanvas);
11260
11291
  break;
@@ -11959,15 +11990,12 @@ const canvas = LeaferCanvasBase.prototype;
11959
11990
  const debug = Debug.get('@leafer-ui/export');
11960
11991
  canvas.export = function (filename, options) {
11961
11992
  const { quality, blob } = FileHelper.getExportOptions(options);
11962
- if (filename.includes('.')) {
11993
+ if (filename.includes('.'))
11963
11994
  return this.saveAs(filename, quality);
11964
- }
11965
- else if (blob) {
11995
+ else if (blob)
11966
11996
  return this.toBlob(filename, quality);
11967
- }
11968
- else {
11997
+ else
11969
11998
  return this.toDataURL(filename, quality);
11970
- }
11971
11999
  };
11972
12000
  canvas.toBlob = function (type, quality) {
11973
12001
  return new Promise((resolve) => {