@leafer-ui/image 2.0.5 → 2.0.7

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.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/src/image.ts +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-ui/image",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
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": "2.0.5",
26
- "@leafer-ui/draw": "2.0.5"
25
+ "@leafer/core": "2.0.7",
26
+ "@leafer-ui/draw": "2.0.7"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "2.0.5",
30
- "@leafer-ui/interface": "2.0.5"
29
+ "@leafer/interface": "2.0.7",
30
+ "@leafer-ui/interface": "2.0.7"
31
31
  }
32
32
  }
package/src/image.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IBoundsData, IImageEvent, ILeaferImage, IObject } from '@leafer/interface'
2
- import { Bounds, BoundsHelper, ImageEvent, ImageManager } from '@leafer/core'
2
+ import { Bounds, BoundsHelper, ImageEvent, ImageManager, LeafHelper } from '@leafer/core'
3
3
 
4
4
  import { IUI, IImagePaint, ILeafPaint } from '@leafer-ui/interface'
5
5
  import { PaintImage } from "@leafer-ui/draw"
@@ -86,6 +86,7 @@ export function image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds:
86
86
 
87
87
 
88
88
  function checkSizeAndCreateData(ui: IUI, attrName: string, paint: IImagePaint, image: ILeaferImage, leafPaint: ILeafPaint, boxBounds: IBoundsData): boolean {
89
+ let needUpdate = true
89
90
  const data = ui.__
90
91
 
91
92
  if (attrName === 'fill' && !data.__naturalWidth) {
@@ -93,11 +94,12 @@ function checkSizeAndCreateData(ui: IUI, attrName: string, paint: IImagePaint, i
93
94
  data.__naturalHeight = image.height / data.pixelRatio
94
95
  if (data.__autoSide) {
95
96
  ui.forceUpdate('width')
97
+ LeafHelper.updateBounds(ui) // 立即更新 boxBounds
96
98
  if (ui.__proxyData) {
97
99
  ui.setProxyAttr('width', data.width)
98
100
  ui.setProxyAttr('height', data.height)
99
101
  }
100
- return false
102
+ needUpdate = false
101
103
  }
102
104
  }
103
105
 
@@ -111,7 +113,7 @@ function checkSizeAndCreateData(ui: IUI, attrName: string, paint: IImagePaint, i
111
113
 
112
114
  if (paint.filter) PaintImage.applyFilter(leafPaint, image, paint.filter, ui)
113
115
 
114
- return true
116
+ return needUpdate
115
117
  }
116
118
 
117
119