@gradio/imageeditor 0.18.8 → 0.18.10

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,28 @@
1
1
  # @gradio/imageeditor
2
2
 
3
+ ## 0.18.10
4
+
5
+ ### Dependency updates
6
+
7
+ - @gradio/atoms@0.23.1
8
+ - @gradio/statustracker@0.14.0
9
+ - @gradio/client@2.2.0
10
+ - @gradio/image@0.26.2
11
+
12
+ ## 0.18.9
13
+
14
+ ### Fixes
15
+
16
+ - [#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!
17
+
18
+ ### Dependency updates
19
+
20
+ - @gradio/utils@0.12.2
21
+ - @gradio/atoms@0.23.0
22
+ - @gradio/statustracker@0.13.1
23
+ - @gradio/upload@0.17.8
24
+ - @gradio/image@0.26.1
25
+
3
26
  ## 0.18.8
4
27
 
5
28
  ### 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
- if (this.image_editor_context.image_container.width !==
290
- this.dimensions.width ||
291
- this.image_editor_context.image_container.height !==
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
- if (needs_brush_tool && (mode_changed || !textures_initialized)) {
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.8",
3
+ "version": "0.18.10",
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.22.2",
15
- "@gradio/client": "^2.1.0",
14
+ "@gradio/atoms": "^0.23.1",
16
15
  "@gradio/icons": "^0.15.1",
17
- "@gradio/statustracker": "^0.13.0",
18
- "@gradio/image": "^0.26.0",
19
- "@gradio/upload": "^0.17.7",
20
- "@gradio/utils": "^0.12.1"
16
+ "@gradio/client": "^2.2.0",
17
+ "@gradio/statustracker": "^0.14.0",
18
+ "@gradio/image": "^0.26.2",
19
+ "@gradio/upload": "^0.17.8",
20
+ "@gradio/utils": "^0.12.2"
21
21
  },
22
22
  "devDependencies": {
23
- "@gradio/preview": "^0.16.1"
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.image_editor_context.image_container.width !==
404
- this.dimensions.width ||
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
  }
@@ -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
- if (needs_brush_tool && (mode_changed || !textures_initialized)) {
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