moveOrigin for zoomabledoodler

This commit is contained in:
2023-10-28 07:38:29 -06:00
parent 0959386ec2
commit a7e7cd139f
3 changed files with 79 additions and 31 deletions

View File

@@ -197,6 +197,13 @@ export class ZoomableDoodler extends Doodler {
this.origin.y = p.y - (p.y - this.origin.y) * scaleBy;
this.constrainOrigin();
}
moveOrigin(motion: Point) {
if (this.scale > 1) {
this.origin.x += motion.x;
this.origin.y += motion.y;
this.constrainOrigin();
}
}
drag(prev: Point) {
if (this.scale > 1) {
const xOffset = this.mouse.x - prev.x;