diff options
author | bobzel <zzzman@gmail.com> | 2020-10-12 01:34:00 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2020-10-12 01:34:00 -0400 |
commit | 9f6dba274539a78a541afd398c73a17dec996319 (patch) | |
tree | d4e3ec17d7e21d5dedbc8c8dda2fe4bd49b0ee81 | |
parent | 27635402ad810b910557eb1a86c7e85fa281aaee (diff) |
capped zoom in at a factor of 20. fixed zoom in not to pan when it hits its zoom in limit.
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 4df90e8ea..71519f2b9 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -783,10 +783,14 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P let deltaScale = deltaY > 0 ? (1 / 1.05) : 1.05; if (deltaScale < 0) deltaScale = -deltaScale; const [x, y] = this.getTransform().transformPoint(pointX, pointY); + const invTransform = this.getLocalTransform().inverse(); + if (deltaScale * invTransform.Scale > 20) { + deltaScale = 20 / invTransform.Scale; + } const localTransform = this.getLocalTransform().inverse().scaleAbout(deltaScale, x, y); if (localTransform.Scale >= 0.15 || localTransform.Scale > this.zoomScaling()) { - const safeScale = Math.min(Math.max(0.15, localTransform.Scale), 40); + const safeScale = Math.min(Math.max(0.15, localTransform.Scale), 20); this.props.Document[this.scaleFieldKey] = Math.abs(safeScale); this.setPan(-localTransform.TranslateX / safeScale, -localTransform.TranslateY / safeScale); } |