@gradio/imageeditor 0.18.8 → 0.18.9
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @gradio/imageeditor
|
|
2
2
|
|
|
3
|
+
## 0.18.9
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
- [#12981](https://github.com/gradio-app/gradio/pull/12981) [`8bc7513`](https://github.com/gradio-app/gradio/commit/8bc75137b24ba8a8571b49b9b006741819c0518b) - Fix ImageEditor brush preview dead area on vertical images. Thanks @MaxwellCalkin!
|
|
8
|
+
|
|
9
|
+
### Dependency updates
|
|
10
|
+
|
|
11
|
+
- @gradio/utils@0.12.2
|
|
12
|
+
- @gradio/atoms@0.23.0
|
|
13
|
+
- @gradio/statustracker@0.13.1
|
|
14
|
+
- @gradio/upload@0.17.8
|
|
15
|
+
- @gradio/image@0.26.1
|
|
16
|
+
|
|
3
17
|
## 0.18.8
|
|
4
18
|
|
|
5
19
|
### Dependency updates
|
|
@@ -286,10 +286,9 @@ export class BrushTextures {
|
|
|
286
286
|
* Reinitializes textures when needed (e.g., after resizing).
|
|
287
287
|
*/
|
|
288
288
|
reinitialize() {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
this.
|
|
292
|
-
this.dimensions.height) {
|
|
289
|
+
const local_bounds = this.image_editor_context.image_container.getLocalBounds();
|
|
290
|
+
if (Math.round(local_bounds.width) !== Math.round(this.dimensions.width) ||
|
|
291
|
+
Math.round(local_bounds.height) !== Math.round(this.dimensions.height)) {
|
|
293
292
|
this.initialize_textures();
|
|
294
293
|
}
|
|
295
294
|
}
|
|
@@ -128,7 +128,16 @@ export class BrushTool {
|
|
|
128
128
|
const mode_changed = this.state.mode !== new_mode;
|
|
129
129
|
const needs_brush_tool = tool === "erase" || tool === "draw";
|
|
130
130
|
const textures_initialized = this.brush_textures?.textures_initialized ?? false;
|
|
131
|
-
|
|
131
|
+
let dimensions_changed = false;
|
|
132
|
+
if (this.brush_textures && textures_initialized) {
|
|
133
|
+
const current_bounds = this.image_editor_context.image_container.getLocalBounds();
|
|
134
|
+
const tex_dims = this.brush_textures.get_dimensions();
|
|
135
|
+
dimensions_changed =
|
|
136
|
+
Math.round(current_bounds.width) !== Math.round(tex_dims.width) ||
|
|
137
|
+
Math.round(current_bounds.height) !== Math.round(tex_dims.height);
|
|
138
|
+
}
|
|
139
|
+
if (needs_brush_tool &&
|
|
140
|
+
(mode_changed || !textures_initialized || dimensions_changed)) {
|
|
132
141
|
this.brush_textures?.initialize_textures();
|
|
133
142
|
}
|
|
134
143
|
if (this.state.mode !== new_mode) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/imageeditor",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.9",
|
|
4
4
|
"description": "Gradio UI packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "",
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
"pixi-filters": "^6.1.4",
|
|
12
12
|
"pixi.js": "^8.14.0",
|
|
13
13
|
"tinycolor2": "^1.6.0",
|
|
14
|
-
"@gradio/atoms": "^0.
|
|
15
|
-
"@gradio/client": "^2.1.0",
|
|
14
|
+
"@gradio/atoms": "^0.23.0",
|
|
16
15
|
"@gradio/icons": "^0.15.1",
|
|
17
|
-
"@gradio/
|
|
18
|
-
"@gradio/image": "^0.26.
|
|
19
|
-
"@gradio/
|
|
20
|
-
"@gradio/utils": "^0.12.
|
|
16
|
+
"@gradio/client": "^2.1.0",
|
|
17
|
+
"@gradio/image": "^0.26.1",
|
|
18
|
+
"@gradio/statustracker": "^0.13.1",
|
|
19
|
+
"@gradio/utils": "^0.12.2",
|
|
20
|
+
"@gradio/upload": "^0.17.8"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@gradio/preview": "^0.16.
|
|
23
|
+
"@gradio/preview": "^0.16.2"
|
|
24
24
|
},
|
|
25
25
|
"main_changeset": true,
|
|
26
26
|
"main": "./Index.svelte",
|
|
@@ -399,11 +399,11 @@ export class BrushTextures {
|
|
|
399
399
|
* Reinitializes textures when needed (e.g., after resizing).
|
|
400
400
|
*/
|
|
401
401
|
reinitialize(): void {
|
|
402
|
+
const local_bounds =
|
|
403
|
+
this.image_editor_context.image_container.getLocalBounds();
|
|
402
404
|
if (
|
|
403
|
-
this.
|
|
404
|
-
|
|
405
|
-
this.image_editor_context.image_container.height !==
|
|
406
|
-
this.dimensions.height
|
|
405
|
+
Math.round(local_bounds.width) !== Math.round(this.dimensions.width) ||
|
|
406
|
+
Math.round(local_bounds.height) !== Math.round(this.dimensions.height)
|
|
407
407
|
) {
|
|
408
408
|
this.initialize_textures();
|
|
409
409
|
}
|
package/shared/brush/brush.ts
CHANGED
|
@@ -169,7 +169,20 @@ export class BrushTool implements Tool {
|
|
|
169
169
|
const textures_initialized =
|
|
170
170
|
this.brush_textures?.textures_initialized ?? false;
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
let dimensions_changed = false;
|
|
173
|
+
if (this.brush_textures && textures_initialized) {
|
|
174
|
+
const current_bounds =
|
|
175
|
+
this.image_editor_context.image_container.getLocalBounds();
|
|
176
|
+
const tex_dims = this.brush_textures.get_dimensions();
|
|
177
|
+
dimensions_changed =
|
|
178
|
+
Math.round(current_bounds.width) !== Math.round(tex_dims.width) ||
|
|
179
|
+
Math.round(current_bounds.height) !== Math.round(tex_dims.height);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (
|
|
183
|
+
needs_brush_tool &&
|
|
184
|
+
(mode_changed || !textures_initialized || dimensions_changed)
|
|
185
|
+
) {
|
|
173
186
|
this.brush_textures?.initialize_textures();
|
|
174
187
|
}
|
|
175
188
|
|