@expofp/renderer 1.4.0 → 1.4.1
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/dist/index.js +9 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5061,7 +5061,14 @@ class ControlsSystem {
|
|
|
5061
5061
|
const { maxZoom, paddingPercent } = opts;
|
|
5062
5062
|
const dpr = this.renderer.context.getPixelRatio();
|
|
5063
5063
|
const visibleRect = this.renderer.visibleRect;
|
|
5064
|
-
const
|
|
5064
|
+
const worldRect = new Rect(this.viewportSystem.svgToWorld(rect.min), this.viewportSystem.svgToWorld(rect.max));
|
|
5065
|
+
const worldPolygon = Polygon.fromRect(worldRect).rotate(-this.controller.azimuthAngle, worldRect.center);
|
|
5066
|
+
const xValues = worldPolygon.vertices.map((p) => p.x);
|
|
5067
|
+
const yValues = worldPolygon.vertices.map((p) => p.y);
|
|
5068
|
+
const sourceRect = new Rect(
|
|
5069
|
+
[Math.min(...xValues), Math.min(...yValues)],
|
|
5070
|
+
[Math.max(...xValues), Math.max(...yValues)]
|
|
5071
|
+
);
|
|
5065
5072
|
const targetRect = visibleRect ? new Rect(visibleRect.min.clone().multiplyScalar(dpr), visibleRect.max.clone().multiplyScalar(dpr)) : new Rect([0, 0], this.renderer.size);
|
|
5066
5073
|
if (paddingPercent) targetRect.addPadding(targetRect.size.x * paddingPercent, targetRect.size.y * paddingPercent);
|
|
5067
5074
|
const zoomByWidth = targetRect.size.x / sourceRect.size.x;
|
|
@@ -5070,7 +5077,7 @@ class ControlsSystem {
|
|
|
5070
5077
|
const zoom = maxZoom ? Math.min(minZoom, maxZoom) : minZoom;
|
|
5071
5078
|
const translate = sourceRect.center;
|
|
5072
5079
|
if (visibleRect) {
|
|
5073
|
-
const offset = new Vector2(...this.renderer.size).multiplyScalar(0.5).sub(targetRect.center).multiplyScalar(1 / zoom);
|
|
5080
|
+
const offset = new Vector2(...this.renderer.size).multiplyScalar(0.5).sub(targetRect.center).multiplyScalar(1 / zoom).rotateAround({ x: 0, y: 0 }, this.controller.azimuthAngle);
|
|
5074
5081
|
translate.add(offset);
|
|
5075
5082
|
}
|
|
5076
5083
|
const enableTransition = !immediate;
|