Skip to content

Commit 483251a

Browse files
feat(ui): do not round scale
Makes it a lot smoother, don't think it breaks anything...
1 parent aa90c4f commit 483251a

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

invokeai/frontend/web/src/features/controlLayers/konva/CanvasStageModule.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,7 @@ export class CanvasStageModule extends CanvasModuleBase {
241241
* Constrains a scale to be within the valid range
242242
*/
243243
constrainScale = (scale: number): number => {
244-
// Round to 2 decimal places to avoid floating point precision issues
245-
const rounded = Math.round(scale * 100) / 100;
246-
const clamped = clamp(rounded, this.config.MIN_SCALE, this.config.MAX_SCALE);
247-
248-
return clamped;
244+
return clamp(scale, this.config.MIN_SCALE, this.config.MAX_SCALE);
249245
};
250246

251247
/**
@@ -264,8 +260,8 @@ export class CanvasStageModule extends CanvasModuleBase {
264260
const deltaX = (_center.x - x) / oldScale;
265261
const deltaY = (_center.y - y) / oldScale;
266262

267-
const newX = Math.floor(_center.x - deltaX * newScale);
268-
const newY = Math.floor(_center.y - deltaY * newScale);
263+
const newX = _center.x - deltaX * newScale;
264+
const newY = _center.y - deltaY * newScale;
269265

270266
this.konva.stage.setAttrs({
271267
x: newX,

0 commit comments

Comments
 (0)