@leafer-ui/image 1.10.0 → 1.10.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/image",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "@leafer-ui/image",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/core": "1.10.0",
26
- "@leafer-ui/draw": "1.10.0"
25
+ "@leafer/core": "1.10.1",
26
+ "@leafer-ui/draw": "1.10.1"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.10.0",
30
- "@leafer-ui/interface": "1.10.0"
29
+ "@leafer/interface": "1.10.1",
30
+ "@leafer-ui/interface": "1.10.1"
31
31
  }
32
32
  }
package/src/check.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { ILeaferCanvas, IRenderOptions, IScaleData } from '@leafer/interface'
2
2
  import { Platform, ResizeEvent } from '@leafer/core'
3
3
 
4
- import { IUI, ILeafPaint } from '@leafer-ui/interface'
4
+ import { IUI, ILeafPaint, IImagePaint } from '@leafer-ui/interface'
5
5
  import { PaintImage } from "@leafer-ui/draw"
6
6
 
7
7
 
8
8
  export function checkImage(paint: ILeafPaint, drawImage: boolean, ui: IUI, canvas: ILeaferCanvas, renderOptions: IRenderOptions): boolean {
9
9
  const { scaleX, scaleY } = PaintImage.getImageRenderScaleData(paint, ui, canvas, renderOptions)
10
- const { image, data } = paint, { exporting } = renderOptions
10
+ const { image, data, originPaint } = paint, { exporting } = renderOptions
11
11
 
12
12
  if (!data || (paint.patternId === scaleX + '-' + scaleY && !exporting)) {
13
13
  return false // 生成图案中
@@ -16,7 +16,7 @@ export function checkImage(paint: ILeafPaint, drawImage: boolean, ui: IUI, canva
16
16
  if (drawImage) {
17
17
  if (data.repeat) {
18
18
  drawImage = false
19
- } else if (!(paint.changeful || (Platform.name === 'miniapp' && ResizeEvent.isResizing(ui)) || exporting)) { // 小程序resize过程中直接绘制原图(绕过垃圾回收bug)
19
+ } else if (!((originPaint as IImagePaint).changeful || (Platform.name === 'miniapp' && ResizeEvent.isResizing(ui)) || exporting)) { // 小程序resize过程中直接绘制原图(绕过垃圾回收bug)
20
20
  drawImage = Platform.image.isLarge(image, scaleX, scaleY)
21
21
  }
22
22
  }
@@ -29,7 +29,7 @@ export function checkImage(paint: ILeafPaint, drawImage: boolean, ui: IUI, canva
29
29
  PaintImage.drawImage(paint, scaleX, scaleY, ui, canvas, renderOptions) // 直接绘制图像,不生成图案
30
30
  return true
31
31
  } else {
32
- if (!paint.style || paint.sync || exporting) PaintImage.createPattern(paint, ui, canvas, renderOptions)
32
+ if (!paint.style || (originPaint as IImagePaint).sync || exporting) PaintImage.createPattern(paint, ui, canvas, renderOptions)
33
33
  else PaintImage.createPatternTask(paint, ui, canvas, renderOptions)
34
34
  return false
35
35
  }
@@ -37,10 +37,10 @@ export function checkImage(paint: ILeafPaint, drawImage: boolean, ui: IUI, canva
37
37
  }
38
38
 
39
39
  export function drawImage(paint: ILeafPaint, _imageScaleX: number, _imageScaleY: number, ui: IUI, canvas: ILeaferCanvas, _renderOptions: IRenderOptions): void {
40
- const { data, image, blendMode } = paint, { opacity, transform } = data, view = image.getFull(data.filters), u = ui.__
40
+ const { data, image } = paint, { blendMode } = paint.originPaint as IImagePaint, { opacity, transform } = data, view = image.getFull(data.filters), u = ui.__
41
41
  let { width, height } = image, clipUI: any
42
42
 
43
- if ((transform && !transform.onlyScale) || (clipUI = u.path || u.cornerRadius) || opacity || blendMode) {
43
+ if ((clipUI = (transform && !transform.onlyScale) || u.path || u.cornerRadius) || opacity || blendMode) {
44
44
  canvas.save()
45
45
  clipUI && canvas.clipUI(ui)
46
46
  blendMode && (canvas.blendMode = blendMode)
@@ -56,7 +56,7 @@ export function drawImage(paint: ILeafPaint, _imageScaleX: number, _imageScaleY:
56
56
  }
57
57
 
58
58
  export function getImageRenderScaleData(paint: ILeafPaint, ui: IUI, canvas?: ILeaferCanvas, _renderOptions?: IRenderOptions): IScaleData {
59
- const scaleData = ui.getRenderScaleData(true, paint.scaleFixed), { data } = paint
59
+ const scaleData = ui.getRenderScaleData(true, paint.originPaint.scaleFixed), { data } = paint
60
60
  if (canvas) {
61
61
  const { pixelRatio } = canvas
62
62
  scaleData.scaleX *= pixelRatio
package/src/data.ts CHANGED
@@ -11,10 +11,6 @@ const tempScaleData = {} as IScaleData
11
11
  const tempImage = {} as IBoundsData
12
12
 
13
13
  export function createData(leafPaint: ILeafPaint, image: ILeaferImage, paint: IImagePaint, box: IBoundsData): void {
14
- const { changeful, sync, scaleFixed } = paint
15
- if (changeful) leafPaint.changeful = changeful
16
- if (sync) leafPaint.sync = sync
17
- if (scaleFixed) leafPaint.scaleFixed = scaleFixed
18
14
  leafPaint.data = PaintImage.getPatternData(paint, box, image)
19
15
  }
20
16