@leafer-ui/miniapp 1.0.1 → 1.0.3

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.
@@ -1,9 +1,9 @@
1
- import { LeaferCanvasBase, Platform, canvasPatch, DataHelper, canvasSizeAttrs, ResizeEvent, Creator, LeaferImage, defineKey, FileHelper, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, Bounds, LeafBoundsHelper, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, AnimateEvent, BoundsHelper, Answer, MatrixHelper, AlignHelper, ImageEvent, AroundHelper, PointHelper, Direction4, TwoPointBoundsHelper, TaskProcessor, Matrix } from '@leafer/core';
1
+ import { LeaferCanvasBase, Platform, canvasPatch, DataHelper, canvasSizeAttrs, ResizeEvent, Creator, LeaferImage, defineKey, FileHelper, LeafList, RenderEvent, ChildEvent, WatchEvent, PropertyEvent, LeafHelper, BranchHelper, Bounds, LeafBoundsHelper, Debug, LeafLevelList, LayoutEvent, Run, ImageManager, BoundsHelper, Answer, MatrixHelper, MathHelper, AlignHelper, ImageEvent, AroundHelper, PointHelper, Direction4, TwoPointBoundsHelper, TaskProcessor, Matrix } from '@leafer/core';
2
2
  export * from '@leafer/core';
3
3
  export { LeaferImage } from '@leafer/core';
4
- import { InteractionHelper, InteractionBase, HitCanvasManager, Platform as Platform$1, MatrixHelper as MatrixHelper$1 } from '@leafer-ui/core';
4
+ import { InteractionHelper, InteractionBase, HitCanvasManager } from '@leafer-ui/core';
5
5
  export * from '@leafer-ui/core';
6
- import { PaintImage, ColorConvert, PaintGradient, Export, Group, TextConvert, Paint, Effect } from '@leafer-ui/draw';
6
+ import { PaintImage, ColorConvert, PaintGradient, Export, Group, TextConvert, Paint, Effect, Leafer } from '@leafer-ui/draw';
7
7
 
8
8
  class LeaferCanvas extends LeaferCanvasBase {
9
9
  get allowBackgroundColor() { return false; }
@@ -44,6 +44,8 @@ class LeaferCanvas extends LeaferCanvasBase {
44
44
  const size = { width: width || view.width, height: height || view.height, pixelRatio };
45
45
  this.resize(size);
46
46
  if (this.context) {
47
+ if (this.viewSelect)
48
+ Platform.renderCanvas = this;
47
49
  if (this.context.roundRect) {
48
50
  this.roundRect = function (x, y, width, height, radius) {
49
51
  this.context.roundRect(x, y, width, height, typeof radius === 'number' ? [radius] : radius);
@@ -111,119 +113,120 @@ Object.assign(Creator, {
111
113
  image: (options) => new LeaferImage(options)
112
114
  });
113
115
  function useCanvas(_canvasType, app) {
114
- if (!Platform.origin) {
115
- Platform.origin = {
116
- createCanvas: (width, height, _format) => app.createOffscreenCanvas({ type: '2d', width, height }),
117
- canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(mineType(type), quality),
118
- canvasToBolb: (canvas, type, quality) => canvas.toBuffer(type, { quality }),
119
- canvasSaveAs: (canvas, filePath, quality) => {
120
- let data = canvas.toDataURL(mineType(fileType(filePath)), quality);
121
- data = data.substring(data.indexOf('64,') + 3);
122
- return Platform.origin.download(data, filePath);
123
- },
124
- download(data, filePath) {
125
- return new Promise((resolve, reject) => {
126
- let toAlbum;
127
- if (!filePath.includes('/')) {
128
- filePath = `${app.env.USER_DATA_PATH}/` + filePath;
129
- toAlbum = true;
130
- }
131
- const fs = app.getFileSystemManager();
132
- fs.writeFile({
133
- filePath,
134
- data,
135
- encoding: 'base64',
136
- success() {
137
- if (toAlbum) {
138
- Platform.miniapp.saveToAlbum(filePath).then(() => {
139
- fs.unlink({ filePath });
140
- resolve();
141
- });
142
- }
143
- else {
116
+ Platform.origin = {
117
+ createCanvas: (width, height, _format) => app.createOffscreenCanvas({ type: '2d', width, height }),
118
+ canvasToDataURL: (canvas, type, quality) => canvas.toDataURL(mineType(type), quality),
119
+ canvasToBolb: (canvas, type, quality) => canvas.toBuffer(type, { quality }),
120
+ canvasSaveAs: (canvas, filePath, quality) => {
121
+ let data = canvas.toDataURL(mineType(fileType(filePath)), quality);
122
+ data = data.substring(data.indexOf('64,') + 3);
123
+ return Platform.origin.download(data, filePath);
124
+ },
125
+ download(data, filePath) {
126
+ return new Promise((resolve, reject) => {
127
+ let toAlbum;
128
+ if (!filePath.includes('/')) {
129
+ filePath = `${app.env.USER_DATA_PATH}/` + filePath;
130
+ toAlbum = true;
131
+ }
132
+ const fs = app.getFileSystemManager();
133
+ fs.writeFile({
134
+ filePath,
135
+ data,
136
+ encoding: 'base64',
137
+ success() {
138
+ if (toAlbum) {
139
+ Platform.miniapp.saveToAlbum(filePath).then(() => {
140
+ fs.unlink({ filePath });
144
141
  resolve();
145
- }
146
- },
147
- fail(error) {
148
- reject(error);
142
+ });
149
143
  }
150
- });
151
- });
152
- },
153
- loadImage(src) {
154
- return new Promise((resolve, reject) => {
155
- const img = Platform.canvas.view.createImage();
156
- img.onload = () => { resolve(img); };
157
- img.onerror = (error) => { reject(error); };
158
- img.src = Platform.image.getRealURL(src);
144
+ else {
145
+ resolve();
146
+ }
147
+ },
148
+ fail(error) {
149
+ reject(error);
150
+ }
159
151
  });
160
- },
161
- noRepeat: 'repeat-x'
162
- };
163
- Platform.miniapp = {
164
- select(name) {
165
- return app.createSelectorQuery().select(name);
166
- },
167
- getBounds(select) {
168
- return new Promise((resolve) => {
169
- select.boundingClientRect().exec((res) => {
170
- const rect = res[1];
171
- resolve({ x: rect.top, y: rect.left, width: rect.width, height: rect.height });
172
- });
152
+ });
153
+ },
154
+ loadImage(src) {
155
+ return new Promise((resolve, reject) => {
156
+ const img = Platform.canvas.view.createImage();
157
+ img.onload = () => { resolve(img); };
158
+ img.onerror = (error) => { reject(error); };
159
+ img.src = Platform.image.getRealURL(src);
160
+ });
161
+ },
162
+ noRepeat: 'repeat-x'
163
+ };
164
+ Platform.miniapp = {
165
+ select(name) {
166
+ return app.createSelectorQuery().select(name);
167
+ },
168
+ getBounds(select) {
169
+ return new Promise((resolve) => {
170
+ select.boundingClientRect().exec((res) => {
171
+ const rect = res[1];
172
+ resolve({ x: rect.top, y: rect.left, width: rect.width, height: rect.height });
173
173
  });
174
- },
175
- getSizeView(select) {
176
- return new Promise((resolve) => {
177
- select.fields({ node: true, size: true }).exec((res) => {
178
- const data = res[0];
179
- resolve({ view: data.node, width: data.width, height: data.height });
180
- });
174
+ });
175
+ },
176
+ getSizeView(select) {
177
+ return new Promise((resolve) => {
178
+ select.fields({ node: true, size: true }).exec((res) => {
179
+ const data = res[0];
180
+ resolve({ view: data.node, width: data.width, height: data.height });
181
181
  });
182
- },
183
- saveToAlbum(path) {
184
- return new Promise((resolve) => {
185
- app.getSetting({
186
- success: (res) => {
187
- if (res.authSetting['scope.writePhotosAlbum']) {
188
- app.saveImageToPhotosAlbum({
189
- filePath: path,
190
- success() { resolve(true); }
191
- });
192
- }
193
- else {
194
- app.authorize({
195
- scope: 'scope.writePhotosAlbum',
196
- success: () => {
197
- app.saveImageToPhotosAlbum({
198
- filePath: path,
199
- success() { resolve(true); }
200
- });
201
- },
202
- fail: () => { }
203
- });
204
- }
182
+ });
183
+ },
184
+ saveToAlbum(path) {
185
+ return new Promise((resolve) => {
186
+ app.getSetting({
187
+ success: (res) => {
188
+ if (res.authSetting['scope.writePhotosAlbum']) {
189
+ app.saveImageToPhotosAlbum({
190
+ filePath: path,
191
+ success() { resolve(true); }
192
+ });
205
193
  }
206
- });
194
+ else {
195
+ app.authorize({
196
+ scope: 'scope.writePhotosAlbum',
197
+ success: () => {
198
+ app.saveImageToPhotosAlbum({
199
+ filePath: path,
200
+ success() { resolve(true); }
201
+ });
202
+ },
203
+ fail: () => { }
204
+ });
205
+ }
206
+ }
207
207
  });
208
- },
209
- onWindowResize(fun) {
210
- app.onWindowResize(fun);
211
- },
212
- offWindowResize(fun) {
213
- app.offWindowResize(fun);
214
- }
215
- };
216
- Platform.event = {
217
- stopDefault(_origin) { },
218
- stopNow(_origin) { },
219
- stop(_origin) { }
220
- };
221
- Platform.canvas = Creator.canvas();
222
- Platform.conicGradientSupport = !!Platform.canvas.context.createConicGradient;
223
- }
208
+ });
209
+ },
210
+ onWindowResize(fun) {
211
+ app.onWindowResize(fun);
212
+ },
213
+ offWindowResize(fun) {
214
+ app.offWindowResize(fun);
215
+ }
216
+ };
217
+ Platform.event = {
218
+ stopDefault(_origin) { },
219
+ stopNow(_origin) { },
220
+ stop(_origin) { }
221
+ };
222
+ Platform.canvas = Creator.canvas();
223
+ Platform.conicGradientSupport = !!Platform.canvas.context.createConicGradient;
224
224
  }
225
225
  Platform.name = 'miniapp';
226
- Platform.requestRender = function (render) { Platform.canvas.view.requestAnimationFrame(render); };
226
+ Platform.requestRender = function (render) {
227
+ const { view } = (Platform.renderCanvas || Platform.canvas);
228
+ view.requestAnimationFrame ? view.requestAnimationFrame(render) : setTimeout(render, 16);
229
+ };
227
230
  defineKey(Platform, 'devicePixelRatio', { get() { return Math.max(1, wx.getSystemInfoSync().pixelRatio); } });
228
231
 
229
232
  class Watcher {
@@ -364,9 +367,13 @@ function updateBounds(boundsList) {
364
367
  });
365
368
  }
366
369
  function updateChange(updateList) {
370
+ let layout;
367
371
  updateList.list.forEach(leaf => {
368
- if (leaf.__layout.opacityChanged)
372
+ layout = leaf.__layout;
373
+ if (layout.opacityChanged)
369
374
  updateAllWorldOpacity(leaf);
375
+ if (layout.stateStyleChanged)
376
+ setTimeout(() => layout.stateStyleChanged && leaf.updateState());
370
377
  leaf.__updateChange();
371
378
  });
372
379
  }
@@ -732,7 +739,6 @@ class Renderer {
732
739
  Platform.requestRender(() => {
733
740
  this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - startTime)));
734
741
  if (this.running) {
735
- this.target.emit(AnimateEvent.FRAME);
736
742
  if (this.changed && this.canvas.view)
737
743
  this.render();
738
744
  this.target.emit(RenderEvent.NEXT);
@@ -1533,16 +1539,21 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
1533
1539
  const { get: get$2, translate } = MatrixHelper;
1534
1540
  const tempBox = new Bounds();
1535
1541
  const tempPoint = {};
1542
+ const tempScaleData = {};
1536
1543
  function createData(leafPaint, image, paint, box) {
1537
- const { blendMode } = paint;
1544
+ const { blendMode, sync } = paint;
1538
1545
  if (blendMode)
1539
1546
  leafPaint.blendMode = blendMode;
1547
+ if (sync)
1548
+ leafPaint.sync = sync;
1540
1549
  leafPaint.data = getPatternData(paint, box, image);
1541
1550
  }
1542
1551
  function getPatternData(paint, box, image) {
1543
1552
  let { width, height } = image;
1544
1553
  if (paint.padding)
1545
1554
  box = tempBox.set(box).shrink(paint.padding);
1555
+ if (paint.mode === 'strench')
1556
+ paint.mode = 'stretch';
1546
1557
  const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
1547
1558
  const sameBox = box.width === width && box.height === height;
1548
1559
  const data = { mode };
@@ -1556,13 +1567,10 @@ function getPatternData(paint, box, image) {
1556
1567
  x += (box.width - width * scaleX) / 2, y += (box.height - height * scaleY) / 2;
1557
1568
  }
1558
1569
  }
1559
- else if (size) {
1560
- scaleX = (typeof size === 'number' ? size : size.width) / width;
1561
- scaleY = (typeof size === 'number' ? size : size.height) / height;
1562
- }
1563
- else if (scale) {
1564
- scaleX = typeof scale === 'number' ? scale : scale.x;
1565
- scaleY = typeof scale === 'number' ? scale : scale.y;
1570
+ else if (scale || size) {
1571
+ MathHelper.getScaleData(scale, size, image, tempScaleData);
1572
+ scaleX = tempScaleData.scaleX;
1573
+ scaleY = tempScaleData.scaleY;
1566
1574
  }
1567
1575
  if (align) {
1568
1576
  const imageBounds = { x, y, width: swapWidth, height: swapHeight };
@@ -1574,7 +1582,7 @@ function getPatternData(paint, box, image) {
1574
1582
  if (offset)
1575
1583
  x += offset.x, y += offset.y;
1576
1584
  switch (mode) {
1577
- case 'strench':
1585
+ case 'stretch':
1578
1586
  if (!sameBox)
1579
1587
  width = box.width, height = box.height;
1580
1588
  break;
@@ -1601,7 +1609,7 @@ function getPatternData(paint, box, image) {
1601
1609
  translate(data.transform, box.x, box.y);
1602
1610
  }
1603
1611
  }
1604
- if (scaleX && mode !== 'strench') {
1612
+ if (scaleX && mode !== 'stretch') {
1605
1613
  data.scaleX = scaleX;
1606
1614
  data.scaleY = scaleY;
1607
1615
  }
@@ -1705,7 +1713,7 @@ const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
1705
1713
  const { ceil, abs: abs$1 } = Math;
1706
1714
  function createPattern(ui, paint, pixelRatio) {
1707
1715
  let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1708
- const id = scaleX + '-' + scaleY;
1716
+ const id = scaleX + '-' + scaleY + '-' + pixelRatio;
1709
1717
  if (paint.patternId !== id && !ui.destroyed) {
1710
1718
  scaleX = abs$1(scaleX);
1711
1719
  scaleY = abs$1(scaleY);
@@ -1799,7 +1807,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
1799
1807
  const { abs } = Math;
1800
1808
  function checkImage(ui, canvas, paint, allowPaint) {
1801
1809
  const { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
1802
- if (!paint.data || (paint.patternId === scaleX + '-' + scaleY && !Export.running)) {
1810
+ const { pixelRatio } = canvas;
1811
+ if (!paint.data || (paint.patternId === scaleX + '-' + scaleY + '-' + pixelRatio && !Export.running)) {
1803
1812
  return false;
1804
1813
  }
1805
1814
  else {
@@ -1807,8 +1816,8 @@ function checkImage(ui, canvas, paint, allowPaint) {
1807
1816
  if (allowPaint) {
1808
1817
  if (!data.repeat) {
1809
1818
  let { width, height } = data;
1810
- width *= abs(scaleX) * canvas.pixelRatio;
1811
- height *= abs(scaleY) * canvas.pixelRatio;
1819
+ width *= abs(scaleX) * pixelRatio;
1820
+ height *= abs(scaleY) * pixelRatio;
1812
1821
  if (data.scaleX) {
1813
1822
  width *= data.scaleX;
1814
1823
  height *= data.scaleY;
@@ -1833,15 +1842,15 @@ function checkImage(ui, canvas, paint, allowPaint) {
1833
1842
  return true;
1834
1843
  }
1835
1844
  else {
1836
- if (!paint.style || Export.running) {
1837
- createPattern(ui, paint, canvas.pixelRatio);
1845
+ if (!paint.style || paint.sync || Export.running) {
1846
+ createPattern(ui, paint, pixelRatio);
1838
1847
  }
1839
1848
  else {
1840
1849
  if (!paint.patternTask) {
1841
1850
  paint.patternTask = ImageManager.patternTasker.add(() => __awaiter(this, void 0, void 0, function* () {
1842
1851
  paint.patternTask = null;
1843
1852
  if (canvas.bounds.hit(ui.__nowWorld))
1844
- createPattern(ui, paint, canvas.pixelRatio);
1853
+ createPattern(ui, paint, pixelRatio);
1845
1854
  ui.forceUpdate('surface');
1846
1855
  }), 300);
1847
1856
  }
@@ -1905,14 +1914,16 @@ function linearGradient(paint, box) {
1905
1914
  return data;
1906
1915
  }
1907
1916
  function applyStops(gradient, stops, opacity) {
1908
- let stop;
1909
- for (let i = 0, len = stops.length; i < len; i++) {
1910
- stop = stops[i];
1911
- if (typeof stop === 'string') {
1912
- gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
1913
- }
1914
- else {
1915
- gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
1917
+ if (stops) {
1918
+ let stop;
1919
+ for (let i = 0, len = stops.length; i < len; i++) {
1920
+ stop = stops[i];
1921
+ if (typeof stop === 'string') {
1922
+ gradient.addColorStop(i / (len - 1), ColorConvert.string(stop, opacity));
1923
+ }
1924
+ else {
1925
+ gradient.addColorStop(stop.offset, ColorConvert.string(stop.color, opacity));
1926
+ }
1916
1927
  }
1917
1928
  }
1918
1929
  }
@@ -2668,10 +2679,15 @@ const TextConvertModule = {
2668
2679
  };
2669
2680
 
2670
2681
  function string(color, opacity) {
2671
- if (typeof color === 'string')
2672
- return color;
2682
+ const doOpacity = typeof opacity === 'number' && opacity !== 1;
2683
+ if (typeof color === 'string') {
2684
+ if (doOpacity && ColorConvert.object)
2685
+ color = ColorConvert.object(color);
2686
+ else
2687
+ return color;
2688
+ }
2673
2689
  let a = color.a === undefined ? 1 : color.a;
2674
- if (opacity)
2690
+ if (doOpacity)
2675
2691
  a *= opacity;
2676
2692
  const rgb = color.r + ',' + color.g + ',' + color.b;
2677
2693
  return a === 1 ? 'rgb(' + rgb + ')' : 'rgba(' + rgb + ',' + a + ')';
@@ -2703,6 +2719,7 @@ const ExportModule = {
2703
2719
  export(leaf, filename, options) {
2704
2720
  this.running = true;
2705
2721
  const fileType = FileHelper.fileType(filename);
2722
+ const isDownload = filename.includes('.');
2706
2723
  options = FileHelper.getExportOptions(options);
2707
2724
  return addTask((success) => new Promise((resolve) => {
2708
2725
  const over = (result) => {
@@ -2712,19 +2729,13 @@ const ExportModule = {
2712
2729
  };
2713
2730
  const { toURL } = Platform;
2714
2731
  const { download } = Platform.origin;
2715
- if (filename === 'json') {
2716
- return over({ data: leaf.toJSON(options.json) });
2717
- }
2718
- else if (fileType === 'json') {
2719
- download(toURL(JSON.stringify(leaf.toJSON(options.json)), 'text'), filename);
2720
- return over({ data: true });
2721
- }
2722
- if (filename === 'svg') {
2723
- return over({ data: leaf.toSVG() });
2732
+ if (fileType === 'json') {
2733
+ isDownload && download(toURL(JSON.stringify(leaf.toJSON(options.json)), 'text'), filename);
2734
+ return over({ data: isDownload ? true : leaf.toJSON(options.json) });
2724
2735
  }
2725
- else if (fileType === 'svg') {
2726
- download(toURL(leaf.toSVG(), 'svg'), filename);
2727
- return over({ data: true });
2736
+ if (fileType === 'svg') {
2737
+ isDownload && download(toURL(leaf.toSVG(), 'svg'), filename);
2738
+ return over({ data: isDownload ? true : leaf.toSVG() });
2728
2739
  }
2729
2740
  const { leafer } = leaf;
2730
2741
  if (leafer) {
@@ -2733,14 +2744,8 @@ const ExportModule = {
2733
2744
  let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
2734
2745
  const { worldTransform, isLeafer, isFrame } = leaf;
2735
2746
  const { slice, trim, onCanvas } = options;
2736
- let scale = options.scale || 1;
2737
- let pixelRatio = options.pixelRatio || 1;
2738
2747
  const smooth = options.smooth === undefined ? leafer.config.smooth : options.smooth;
2739
2748
  const contextSettings = options.contextSettings || leafer.config.contextSettings;
2740
- if (leaf.isApp) {
2741
- scale *= pixelRatio;
2742
- pixelRatio = leaf.app.pixelRatio;
2743
- }
2744
2749
  const screenshot = options.screenshot || leaf.isApp;
2745
2750
  const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
2746
2751
  const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
@@ -2774,9 +2779,17 @@ const ExportModule = {
2774
2779
  }
2775
2780
  renderBounds = leaf.getBounds('render', relative);
2776
2781
  }
2777
- const { x, y, width, height } = new Bounds(renderBounds).scale(scale);
2782
+ const scaleData = { scaleX: 1, scaleY: 1 };
2783
+ MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
2784
+ let pixelRatio = options.pixelRatio || 1;
2785
+ if (leaf.isApp) {
2786
+ scaleData.scaleX *= pixelRatio;
2787
+ scaleData.scaleY *= pixelRatio;
2788
+ pixelRatio = leaf.app.pixelRatio;
2789
+ }
2790
+ const { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
2791
+ const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
2778
2792
  let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio, smooth, contextSettings });
2779
- const renderOptions = { matrix: matrix.scale(1 / scale).invert().translate(-x, -y).withScale(1 / scaleX * scale, 1 / scaleY * scale) };
2780
2793
  let sliceLeaf;
2781
2794
  if (slice) {
2782
2795
  sliceLeaf = leaf;
@@ -2884,8 +2897,12 @@ Object.assign(Creator, {
2884
2897
  hitCanvas: (options, manager) => new LeaferCanvas(options, manager),
2885
2898
  hitCanvasManager: () => new HitCanvasManager()
2886
2899
  });
2900
+ Leafer.prototype.receiveEvent = function (event) {
2901
+ this.interaction && this.interaction.receive(event);
2902
+ };
2887
2903
  try {
2888
- useCanvas('wx', wx);
2904
+ if (wx)
2905
+ useCanvas('miniapp', wx);
2889
2906
  }
2890
2907
  catch (_a) { }
2891
2908
 
@@ -2893,12 +2910,12 @@ const systemInfo = wx.getSystemInfoSync();
2893
2910
  const platform = systemInfo.platform;
2894
2911
  if (platform === 'ios') {
2895
2912
  LeaferImage.prototype.getPattern = function (canvas, repeat, transform, paint) {
2896
- const pattern = Platform$1.canvas.createPattern(this.view, repeat);
2913
+ const pattern = Platform.canvas.createPattern(this.view, repeat);
2897
2914
  const { width, height } = canvas;
2898
2915
  if (this.width !== width || this.height !== height) {
2899
2916
  if (!transform)
2900
- transform = MatrixHelper$1.get();
2901
- MatrixHelper$1.scale(transform, width / this.width, height / this.height);
2917
+ transform = MatrixHelper.get();
2918
+ MatrixHelper.scale(transform, width / this.width, height / this.height);
2902
2919
  }
2903
2920
  try {
2904
2921
  if (transform && pattern.setTransform) {