Fix: also save default_units_short when units toggled in dialogs
Keeps the info-bar unit symbol (px, ", cm, mm) in sync when the user switches units via the in-dialog toggle rather than Tools > Settings. https://claude.ai/code/session_017wupXfpjuoSdAqVyak4fJf
This commit is contained in:
@@ -97,7 +97,9 @@ class Image_resize_class {
|
|||||||
var resolution = this.Tools_settings.get_setting('resolution');
|
var resolution = this.Tools_settings.get_setting('resolution');
|
||||||
|
|
||||||
// Persist so Canvas Size and other dialogs open with the same units
|
// Persist so Canvas Size and other dialogs open with the same units
|
||||||
|
const unitShort = {pixels: 'px', inches: '"', centimeters: 'cm', millimetres: 'mm'};
|
||||||
this.Tools_settings.save_setting('default_units', units);
|
this.Tools_settings.save_setting('default_units', units);
|
||||||
|
this.Tools_settings.save_setting('default_units_short', unitShort[units] || units);
|
||||||
|
|
||||||
var newWidth = this.Helper.get_user_unit(config.WIDTH, units, resolution);
|
var newWidth = this.Helper.get_user_unit(config.WIDTH, units, resolution);
|
||||||
var newHeight = this.Helper.get_user_unit(config.HEIGHT, units, resolution);
|
var newHeight = this.Helper.get_user_unit(config.HEIGHT, units, resolution);
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ class Image_size_class {
|
|||||||
var resolution = this.Tools_settings.get_setting('resolution');
|
var resolution = this.Tools_settings.get_setting('resolution');
|
||||||
|
|
||||||
// Persist so Resize and other dialogs open with the same units
|
// Persist so Resize and other dialogs open with the same units
|
||||||
|
const unitShort = {pixels: 'px', inches: '"', centimeters: 'cm', millimetres: 'mm'};
|
||||||
this.Tools_settings.save_setting('default_units', units);
|
this.Tools_settings.save_setting('default_units', units);
|
||||||
|
this.Tools_settings.save_setting('default_units_short', unitShort[units] || units);
|
||||||
|
|
||||||
var newWidth = this.Helper.get_user_unit(config.WIDTH, units, resolution);
|
var newWidth = this.Helper.get_user_unit(config.WIDTH, units, resolution);
|
||||||
var newHeight = this.Helper.get_user_unit(config.HEIGHT, units, resolution);
|
var newHeight = this.Helper.get_user_unit(config.HEIGHT, units, resolution);
|
||||||
|
|||||||
Reference in New Issue
Block a user