@leafer-ui/image 1.0.0-rc.11 → 1.0.0-rc.16

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.0.0-rc.11",
3
+ "version": "1.0.0-rc.16",
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.0.0-rc.11",
26
- "@leafer/draw": "1.0.0-rc.11"
25
+ "@leafer/core": "1.0.0-rc.16",
26
+ "@leafer/draw": "1.0.0-rc.16"
27
27
  },
28
28
  "devDependencies": {
29
- "@leafer/interface": "1.0.0-rc.11",
30
- "@leafer-ui/interface": "1.0.0-rc.11"
29
+ "@leafer/interface": "1.0.0-rc.16",
30
+ "@leafer-ui/interface": "1.0.0-rc.16"
31
31
  }
32
32
  }
package/src/image.ts CHANGED
@@ -70,9 +70,9 @@ export function image(ui: IUI, attrName: string, paint: IImagePaint, boxBounds:
70
70
  function checkSizeAndCreateData(ui: IUI, attrName: string, paint: IImagePaint, image: ILeaferImage, leafPaint: ILeafPaint, boxBounds: IBoundsData): boolean {
71
71
  if (attrName === 'fill' && !ui.__.__naturalWidth) {
72
72
  const data = ui.__
73
- data.__naturalWidth = image.width
74
- data.__naturalHeight = image.height
75
- if (data.__autoWidth || data.__autoHeight) {
73
+ data.__naturalWidth = image.width / data.pixelRatio
74
+ data.__naturalHeight = image.height / data.pixelRatio
75
+ if (data.__autoSide) {
76
76
  ui.forceUpdate('width')
77
77
  if (ui.__proxyData) {
78
78
  ui.setProxyAttr('width', data.width)
package/src/pattern.ts CHANGED
@@ -4,7 +4,7 @@ import { IUI, ILeafPaint, IMatrixData } from '@leafer-ui/interface'
4
4
 
5
5
 
6
6
  const { get, scale, copy } = MatrixHelper
7
- const { round, abs } = Math
7
+ const { ceil, abs } = Math
8
8
 
9
9
  export function createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): boolean {
10
10
 
@@ -68,7 +68,7 @@ export function createPattern(ui: IUI, paint: ILeafPaint, pixelRatio: number): b
68
68
  scale(imageMatrix, 1 / scaleX, 1 / scaleY)
69
69
  }
70
70
 
71
- const canvas = image.getCanvas(width < 1 ? 1 : round(width), height < 1 ? 1 : round(height), opacity)
71
+ const canvas = image.getCanvas(ceil(width) || 1, ceil(height) || 1, opacity)
72
72
  const pattern = image.getPattern(canvas, repeat || (Platform.origin.noRepeat || 'no-repeat'), imageMatrix, paint)
73
73
 
74
74
  paint.style = pattern