template-replacement 3.3.0 → 3.3.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 +1 -1
- package/replace/image.ts +12 -4
- package/worker/main/index.ts +1 -1
package/package.json
CHANGED
package/replace/image.ts
CHANGED
|
@@ -76,11 +76,19 @@ export default class image {
|
|
|
76
76
|
|
|
77
77
|
async getExtent(): Promise<extent> {
|
|
78
78
|
if (!this.wpExtent) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
if (this.file.size) {
|
|
80
|
+
try {
|
|
81
|
+
const bitmap = await createImageBitmap(this.file)
|
|
82
|
+
!this.wpExtent && this.setPxExtent(bitmap.width, bitmap.height)
|
|
83
|
+
bitmap.close()
|
|
84
|
+
return this.wpExtent!
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.error(error)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
!this.wpExtent && this.setPxExtent(0, 0)
|
|
82
90
|
}
|
|
83
|
-
return this.wpExtent
|
|
91
|
+
return this.wpExtent!
|
|
84
92
|
}
|
|
85
93
|
|
|
86
94
|
//设置图片范围(像素)
|
package/worker/main/index.ts
CHANGED