@leafer-in/view 1.4.2 → 1.5.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/view.cjs +1 -2
- package/dist/view.cjs.map +1 -1
- package/dist/view.esm.js +1 -2
- package/dist/view.esm.js.map +1 -1
- package/dist/view.esm.min.js +1 -1
- package/dist/view.esm.min.js.map +1 -1
- package/dist/view.js +1 -2
- package/dist/view.js.map +1 -1
- package/dist/view.min.cjs +1 -1
- package/dist/view.min.cjs.map +1 -1
- package/dist/view.min.js +1 -1
- package/dist/view.min.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -3
package/dist/view.cjs
CHANGED
|
@@ -36,7 +36,7 @@ draw.Leafer.prototype.zoom = function (zoomType, padding, fixed, transition) {
|
|
|
36
36
|
const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new draw.Bounds();
|
|
37
37
|
const center = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 };
|
|
38
38
|
let changeScale;
|
|
39
|
-
const { scaleX } =
|
|
39
|
+
const { x, y, scaleX, scaleY } = zoomLayer.__;
|
|
40
40
|
if (typeof zoomType === 'string') {
|
|
41
41
|
switch (zoomType) {
|
|
42
42
|
case 'in':
|
|
@@ -66,7 +66,6 @@ draw.Leafer.prototype.zoom = function (zoomType, padding, fixed, transition) {
|
|
|
66
66
|
zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition);
|
|
67
67
|
}
|
|
68
68
|
else if (typeof zoomType === 'object') {
|
|
69
|
-
const { x, y, scaleX, scaleY } = zoomLayer;
|
|
70
69
|
const data = { x, y, scaleX, scaleY };
|
|
71
70
|
const isArray = zoomType instanceof Array;
|
|
72
71
|
if (isArray || zoomType.tag) {
|
package/dist/view.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.cjs","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { scaleX } =
|
|
1
|
+
{"version":3,"file":"view.cjs","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { x, y, scaleX, scaleY } = zoomLayer.__\n\n if (typeof zoomType === 'string') {\n\n switch (zoomType) {\n case 'in':\n changeScale = getZoomScale(scaleX, 'in')\n break\n case 'out':\n changeScale = getZoomScale(scaleX, 'out')\n break\n case 'fit':\n zoomType = this.boxBounds\n break\n case 'fit-width':\n zoomType = new Bounds(this.boxBounds)\n zoomType.height = 0\n break\n case 'fit-height':\n zoomType = new Bounds(this.boxBounds)\n zoomType.width = 0\n break\n }\n\n } else if (typeof zoomType === 'number') {\n changeScale = zoomType / scaleX\n }\n\n\n if (changeScale) {\n\n changeScale = this.getValidScale(changeScale)\n zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition)\n\n } else if (typeof zoomType === 'object') {\n\n const data = { x, y, scaleX, scaleY }\n const isArray = zoomType instanceof Array\n\n if (isArray || (zoomType as ILeaf).tag) {\n const list: ILeaf[] = isArray ? zoomType as ILeaf[] : [zoomType as ILeaf]\n bounds.setListWithFn(list, LeafBoundsHelper.worldBounds)\n } else {\n const innerBounds = getFixBounds(zoomType as IBoundsData, limitBounds)\n bounds.set(zoomLayer.getWorldBounds(innerBounds))\n }\n\n const { width, height } = bounds\n let moveX = limitBounds.x - bounds.x, moveY = limitBounds.y - bounds.y\n\n if (fixed) {\n\n moveX += Math.max((limitBounds.width - width) / 2, 0)\n moveY += Math.max((limitBounds.height - height) / 2, 0)\n\n } else {\n\n changeScale = this.getValidScale(Math.min(limitBounds.width / width, limitBounds.height / height))\n moveX += (limitBounds.width - width * changeScale) / 2\n moveY += (limitBounds.height - height * changeScale) / 2\n\n PointHelper.scaleOf(data, bounds, changeScale)\n bounds.scaleOf(bounds, changeScale)\n\n data.scaleX *= changeScale\n data.scaleY *= changeScale\n }\n\n PointHelper.move(data, moveX, moveY)\n bounds.move(moveX, moveY)\n\n zoomLayer.set(data, transition)\n\n return bounds\n\n }\n\n return zoomLayer.worldBoxBounds\n\n}"],"names":["Plugin","Leafer","Bounds","LeafBoundsHelper","PointHelper"],"mappings":";;;;AAGgB,SAAA,YAAY,CAAC,MAAc,EAAE,IAAkB,EAAA;IAC3D,IAAI,KAAK,GAAG,CAAC;AACb,IAAA,MAAM,GAAG,GAAG,IAAI,KAAK,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;AACvD,IAAA,IAAI,QAAQ,GAAG,CAAC,EAAE;AACd,QAAA,OAAO,GAAG,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,IAAI,QAAQ;YAAE,KAAK,IAAI,CAAC;AAC7D,QAAA,IAAI,GAAG;YAAE,KAAK,IAAI,CAAC;;SAChB;AACH,QAAA,OAAO,GAAG,GAAG,KAAK,IAAI,QAAQ,GAAG,KAAK,GAAG,QAAQ;YAAE,KAAK,IAAI,CAAC;AAC7D,QAAA,IAAI,CAAC,GAAG;YAAE,KAAK,IAAI,CAAC;;IAExB,OAAO,KAAK,GAAG,MAAM;AACzB;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,CAAC;AACpC,QAAA,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC;AAEzB,QAAA,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC;AAE/B,QAAA,OAAO,MAAM;;IAIjB,OAAO,SAAS,CAAC,cAAc;AAEnC,CAAC;;"}
|
package/dist/view.esm.js
CHANGED
|
@@ -34,7 +34,7 @@ Leafer.prototype.zoom = function (zoomType, padding, fixed, transition) {
|
|
|
34
34
|
const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds();
|
|
35
35
|
const center = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 };
|
|
36
36
|
let changeScale;
|
|
37
|
-
const { scaleX } =
|
|
37
|
+
const { x, y, scaleX, scaleY } = zoomLayer.__;
|
|
38
38
|
if (typeof zoomType === 'string') {
|
|
39
39
|
switch (zoomType) {
|
|
40
40
|
case 'in':
|
|
@@ -64,7 +64,6 @@ Leafer.prototype.zoom = function (zoomType, padding, fixed, transition) {
|
|
|
64
64
|
zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition);
|
|
65
65
|
}
|
|
66
66
|
else if (typeof zoomType === 'object') {
|
|
67
|
-
const { x, y, scaleX, scaleY } = zoomLayer;
|
|
68
67
|
const data = { x, y, scaleX, scaleY };
|
|
69
68
|
const isArray = zoomType instanceof Array;
|
|
70
69
|
if (isArray || zoomType.tag) {
|
package/dist/view.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.esm.js","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { scaleX } =
|
|
1
|
+
{"version":3,"file":"view.esm.js","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { x, y, scaleX, scaleY } = zoomLayer.__\n\n if (typeof zoomType === 'string') {\n\n switch (zoomType) {\n case 'in':\n changeScale = getZoomScale(scaleX, 'in')\n break\n case 'out':\n changeScale = getZoomScale(scaleX, 'out')\n break\n case 'fit':\n zoomType = this.boxBounds\n break\n case 'fit-width':\n zoomType = new Bounds(this.boxBounds)\n zoomType.height = 0\n break\n case 'fit-height':\n zoomType = new Bounds(this.boxBounds)\n zoomType.width = 0\n break\n }\n\n } else if (typeof zoomType === 'number') {\n changeScale = zoomType / scaleX\n }\n\n\n if (changeScale) {\n\n changeScale = this.getValidScale(changeScale)\n zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition)\n\n } else if (typeof zoomType === 'object') {\n\n const data = { x, y, scaleX, scaleY }\n const isArray = zoomType instanceof Array\n\n if (isArray || (zoomType as ILeaf).tag) {\n const list: ILeaf[] = isArray ? zoomType as ILeaf[] : [zoomType as ILeaf]\n bounds.setListWithFn(list, LeafBoundsHelper.worldBounds)\n } else {\n const innerBounds = getFixBounds(zoomType as IBoundsData, limitBounds)\n bounds.set(zoomLayer.getWorldBounds(innerBounds))\n }\n\n const { width, height } = bounds\n let moveX = limitBounds.x - bounds.x, moveY = limitBounds.y - bounds.y\n\n if (fixed) {\n\n moveX += Math.max((limitBounds.width - width) / 2, 0)\n moveY += Math.max((limitBounds.height - height) / 2, 0)\n\n } else {\n\n changeScale = this.getValidScale(Math.min(limitBounds.width / width, limitBounds.height / height))\n moveX += (limitBounds.width - width * changeScale) / 2\n moveY += (limitBounds.height - height * changeScale) / 2\n\n PointHelper.scaleOf(data, bounds, changeScale)\n bounds.scaleOf(bounds, changeScale)\n\n data.scaleX *= changeScale\n data.scaleY *= changeScale\n }\n\n PointHelper.move(data, moveX, moveY)\n bounds.move(moveX, moveY)\n\n zoomLayer.set(data, transition)\n\n return bounds\n\n }\n\n return zoomLayer.worldBoxBounds\n\n}"],"names":[],"mappings":";;AAGgB,SAAA,YAAY,CAAC,MAAc,EAAE,IAAkB,EAAA;IAC3D,IAAI,KAAK,GAAG,CAAC;AACb,IAAA,MAAM,GAAG,GAAG,IAAI,KAAK,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;AACvD,IAAA,IAAI,QAAQ,GAAG,CAAC,EAAE;AACd,QAAA,OAAO,GAAG,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,IAAI,QAAQ;YAAE,KAAK,IAAI,CAAC;AAC7D,QAAA,IAAI,GAAG;YAAE,KAAK,IAAI,CAAC;;SAChB;AACH,QAAA,OAAO,GAAG,GAAG,KAAK,IAAI,QAAQ,GAAG,KAAK,GAAG,QAAQ;YAAE,KAAK,IAAI,CAAC;AAC7D,QAAA,IAAI,CAAC,GAAG;YAAE,KAAK,IAAI,CAAC;;IAExB,OAAO,KAAK,GAAG,MAAM;AACzB;AAEgB,SAAA,YAAY,CAAC,MAAmB,EAAE,WAAwB,EAAA;IACtE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;AACpC,IAAA,IAAI,GAAY;AAChB,IAAA,IAAI,CAAC,MAAM;AAAE,QAAA,MAAM,GAAG,KAAK,IAAI,WAAW,CAAC,MAAM,GAAG,WAAW,CA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import{Plugin as t,Leafer as e,Bounds as i,LeafBoundsHelper as s,PointHelper as h}from"@leafer-ui/draw";function o(t,e){let i=1;const s="out"===e,h=Math.abs(t);if(h>1){for(;s?i<h:i<=h;)i*=2;s&&(i/=2)}else{for(;s?i>=h:i>h;)i/=2;s||(i*=2)}return i/t}t.add("view"),e.prototype.zoom=function(t,e,a,n){this.killAnimate();const{zoomLayer:c}=this,l=this.canvas.bounds.clone().shrink(void 0!==e?e:30),r=new i,d={x:l.x+l.width/2,y:l.y+l.height/2};let f;const{scaleX:
|
|
1
|
+
import{Plugin as t,Leafer as e,Bounds as i,LeafBoundsHelper as s,PointHelper as h}from"@leafer-ui/draw";function o(t,e){let i=1;const s="out"===e,h=Math.abs(t);if(h>1){for(;s?i<h:i<=h;)i*=2;s&&(i/=2)}else{for(;s?i>=h:i>h;)i/=2;s||(i*=2)}return i/t}t.add("view"),e.prototype.zoom=function(t,e,a,n){this.killAnimate();const{zoomLayer:c}=this,l=this.canvas.bounds.clone().shrink(void 0!==e?e:30),r=new i,d={x:l.x+l.width/2,y:l.y+l.height/2};let f;const{x:u,y:w,scaleX:g,scaleY:x}=c.__;if("string"==typeof t)switch(t){case"in":f=o(g,"in");break;case"out":f=o(g,"out");break;case"fit":t=this.boxBounds;break;case"fit-width":(t=new i(this.boxBounds)).height=0;break;case"fit-height":(t=new i(this.boxBounds)).width=0}else"number"==typeof t&&(f=t/g);if(f)f=this.getValidScale(f),c.scaleOfWorld(d,f,f,!1,n);else if("object"==typeof t){const e={x:u,y:w,scaleX:g,scaleY:x},i=t instanceof Array;if(i||t.tag){const e=i?t:[t];r.setListWithFn(e,s.worldBounds)}else{const e=function(t,e){let i,{x:s,y:h,width:o,height:a}=t;return a||(a=o*(e.height/e.width),i=!0),o||(o=a*(e.width/e.height),i=!0),i?{x:s,y:h,width:o,height:a}:t}(t,l);r.set(c.getWorldBounds(e))}const{width:o,height:d}=r;let y=l.x-r.x,b=l.y-r.y;return a?(y+=Math.max((l.width-o)/2,0),b+=Math.max((l.height-d)/2,0)):(f=this.getValidScale(Math.min(l.width/o,l.height/d)),y+=(l.width-o*f)/2,b+=(l.height-d*f)/2,h.scaleOf(e,r,f),r.scaleOf(r,f),e.scaleX*=f,e.scaleY*=f),h.move(e,y,b),r.move(y,b),c.set(e,n),r}return c.worldBoxBounds};
|
|
2
2
|
//# sourceMappingURL=view.esm.min.js.map
|
package/dist/view.esm.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.esm.min.js","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { scaleX } =
|
|
1
|
+
{"version":3,"file":"view.esm.min.js","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { x, y, scaleX, scaleY } = zoomLayer.__\n\n if (typeof zoomType === 'string') {\n\n switch (zoomType) {\n case 'in':\n changeScale = getZoomScale(scaleX, 'in')\n break\n case 'out':\n changeScale = getZoomScale(scaleX, 'out')\n break\n case 'fit':\n zoomType = this.boxBounds\n break\n case 'fit-width':\n zoomType = new Bounds(this.boxBounds)\n zoomType.height = 0\n break\n case 'fit-height':\n zoomType = new Bounds(this.boxBounds)\n zoomType.width = 0\n break\n }\n\n } else if (typeof zoomType === 'number') {\n changeScale = zoomType / scaleX\n }\n\n\n if (changeScale) {\n\n changeScale = this.getValidScale(changeScale)\n zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition)\n\n } else if (typeof zoomType === 'object') {\n\n const data = { x, y, scaleX, scaleY }\n const isArray = zoomType instanceof Array\n\n if (isArray || (zoomType as ILeaf).tag) {\n const list: ILeaf[] = isArray ? zoomType as ILeaf[] : [zoomType as ILeaf]\n bounds.setListWithFn(list, LeafBoundsHelper.worldBounds)\n } else {\n const innerBounds = getFixBounds(zoomType as IBoundsData, limitBounds)\n bounds.set(zoomLayer.getWorldBounds(innerBounds))\n }\n\n const { width, height } = bounds\n let moveX = limitBounds.x - bounds.x, moveY = limitBounds.y - bounds.y\n\n if (fixed) {\n\n moveX += Math.max((limitBounds.width - width) / 2, 0)\n moveY += Math.max((limitBounds.height - height) / 2, 0)\n\n } else {\n\n changeScale = this.getValidScale(Math.min(limitBounds.width / width, limitBounds.height / height))\n moveX += (limitBounds.width - width * changeScale) / 2\n moveY += (limitBounds.height - height * changeScale) / 2\n\n PointHelper.scaleOf(data, bounds, changeScale)\n bounds.scaleOf(bounds, changeScale)\n\n data.scaleX *= changeScale\n data.scaleY *= changeScale\n }\n\n PointHelper.move(data, moveX, moveY)\n bounds.move(moveX, moveY)\n\n zoomLayer.set(data, transition)\n\n return bounds\n\n }\n\n return zoomLayer.worldBoxBounds\n\n}"],"names":["getZoomScale","scaleX","type","scale","out","absScale","Math","abs","Plugin","add","Leafer","prototype","zoom","zoomType","padding","fixed","transition","this","killAnimate","zoomLayer","limitBounds","canvas","bounds","clone","shrink","undefined","Bounds","center","x","width","y","height","changeScale","scaleY","__","boxBounds","getValidScale","scaleOfWorld","data","isArray","Array","tag","list","setListWithFn","LeafBoundsHelper","worldBounds","innerBounds","scaleBounds","fix","getFixBounds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OC,GAEnBlC,EAAU+B,IAAIZ,EAAMtB,GAEbM,EAIX,OAAOH,EAAUwC,cAErB"}
|
package/dist/view.js
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new draw.Bounds();
|
|
36
36
|
const center = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 };
|
|
37
37
|
let changeScale;
|
|
38
|
-
const { scaleX } =
|
|
38
|
+
const { x, y, scaleX, scaleY } = zoomLayer.__;
|
|
39
39
|
if (typeof zoomType === 'string') {
|
|
40
40
|
switch (zoomType) {
|
|
41
41
|
case 'in':
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition);
|
|
66
66
|
}
|
|
67
67
|
else if (typeof zoomType === 'object') {
|
|
68
|
-
const { x, y, scaleX, scaleY } = zoomLayer;
|
|
69
68
|
const data = { x, y, scaleX, scaleY };
|
|
70
69
|
const isArray = zoomType instanceof Array;
|
|
71
70
|
if (isArray || zoomType.tag) {
|
package/dist/view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { scaleX } =
|
|
1
|
+
{"version":3,"file":"view.js","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { x, y, scaleX, scaleY } = zoomLayer.__\n\n if (typeof zoomType === 'string') {\n\n switch (zoomType) {\n case 'in':\n changeScale = getZoomScale(scaleX, 'in')\n break\n case 'out':\n changeScale = getZoomScale(scaleX, 'out')\n break\n case 'fit':\n zoomType = this.boxBounds\n break\n case 'fit-width':\n zoomType = new Bounds(this.boxBounds)\n zoomType.height = 0\n break\n case 'fit-height':\n zoomType = new Bounds(this.boxBounds)\n zoomType.width = 0\n break\n }\n\n } else if (typeof zoomType === 'number') {\n changeScale = zoomType / scaleX\n }\n\n\n if (changeScale) {\n\n changeScale = this.getValidScale(changeScale)\n zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition)\n\n } else if (typeof zoomType === 'object') {\n\n const data = { x, y, scaleX, scaleY }\n const isArray = zoomType instanceof Array\n\n if (isArray || (zoomType as ILeaf).tag) {\n const list: ILeaf[] = isArray ? zoomType as ILeaf[] : [zoomType as ILeaf]\n bounds.setListWithFn(list, LeafBoundsHelper.worldBounds)\n } else {\n const innerBounds = getFixBounds(zoomType as IBoundsData, limitBounds)\n bounds.set(zoomLayer.getWorldBounds(innerBounds))\n }\n\n const { width, height } = bounds\n let moveX = limitBounds.x - bounds.x, moveY = limitBounds.y - bounds.y\n\n if (fixed) {\n\n moveX += Math.max((limitBounds.width - width) / 2, 0)\n moveY += Math.max((limitBounds.height - height) / 2, 0)\n\n } else {\n\n changeScale = this.getValidScale(Math.min(limitBounds.width / width, limitBounds.height / height))\n moveX += (limitBounds.width - width * changeScale) / 2\n moveY += (limitBounds.height - height * changeScale) / 2\n\n PointHelper.scaleOf(data, bounds, changeScale)\n bounds.scaleOf(bounds, changeScale)\n\n data.scaleX *= changeScale\n data.scaleY *= changeScale\n }\n\n PointHelper.move(data, moveX, moveY)\n bounds.move(moveX, moveY)\n\n zoomLayer.set(data, transition)\n\n return bounds\n\n }\n\n return zoomLayer.worldBoxBounds\n\n}"],"names":["Plugin","Leafer","Bounds","LeafBoundsHelper","PointHelper"],"mappings":";;;IAGgB,SAAA,YAAY,CAAC,MAAc,EAAE,IAAkB,EAAA;QAC3D,IAAI,KAAK,GAAG,CAAC;IACb,IAAA,MAAM,GAAG,GAAG,IAAI,KAAK,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;IACvD,IAAA,IAAI,QAAQ,GAAG,CAAC,EAAE;IACd,QAAA,OAAO,GAAG,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,IAAI,QAAQ;gBAAE,KAAK,IAAI,CAAC;IAC7D,QAAA,IAAI,GAAG;gBAAE,KAAK,IAAI,CAAC;;aAChB;IACH,QAAA,OAAO,GAAG,GAAG,KAAK,IAAI,QAAQ,GAAG,KAAK,GAAG,QAAQ;gBAAE,KAAK,IAAI,CAAC;IAC7D,QAAA,IAAI,CAAC,GAAG;gBAAE,KAAK,IAAI,CAAC;;QAExB,OAAO,KAAK,GAAG,MAAM;IACzB;IAEgB,SAAA,YAAY,CAAC,MAAmB,EAAE,WAAwB,EAAA;QACtE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IACpC,IAAA,IAAI,GAAY;IAChB,IAAA,IAAI,CAAC,MAAM;IAAE,QAAA,MAAM,GAAG,KAAK,IAAI,WAAW,CAAC,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI;IAClF,IAAA,IAAI,CAAC,KAAK;IAAE,QAAA,KAAK,GAAG,MAAM,IAAI,WAAW,CAAC,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,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e}e.Plugin.add("view"),e.Leafer.prototype.zoom=function(i,s,o,h){this.killAnimate();const{zoomLayer:n}=this,a=this.canvas.bounds.clone().shrink(void 0!==s?s:30),r=new e.Bounds,l={x:a.x+a.width/2,y:a.y+a.height/2};let c;const{scaleX:
|
|
1
|
+
"use strict";var e=require("@leafer-ui/draw");function t(e,t){let i=1;const s="out"===t,o=Math.abs(e);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/e}e.Plugin.add("view"),e.Leafer.prototype.zoom=function(i,s,o,h){this.killAnimate();const{zoomLayer:n}=this,a=this.canvas.bounds.clone().shrink(void 0!==s?s:30),r=new e.Bounds,l={x:a.x+a.width/2,y:a.y+a.height/2};let c;const{x:d,y:u,scaleX:f,scaleY:w}=n.__;if("string"==typeof i)switch(i){case"in":c=t(f,"in");break;case"out":c=t(f,"out");break;case"fit":i=this.boxBounds;break;case"fit-width":(i=new e.Bounds(this.boxBounds)).height=0;break;case"fit-height":(i=new e.Bounds(this.boxBounds)).width=0}else"number"==typeof i&&(c=i/f);if(c)c=this.getValidScale(c),n.scaleOfWorld(l,c,c,!1,h);else if("object"==typeof i){const t={x:d,y:u,scaleX:f,scaleY:w},s=i instanceof Array;if(s||i.tag){const t=s?i:[i];r.setListWithFn(t,e.LeafBoundsHelper.worldBounds)}else{const e=function(e,t){let i,{x:s,y:o,width:h,height:n}=e;return n||(n=h*(t.height/t.width),i=!0),h||(h=n*(t.width/t.height),i=!0),i?{x:s,y:o,width:h,height:n}:e}(i,a);r.set(n.getWorldBounds(e))}const{width:l,height:g}=r;let x=a.x-r.x,y=a.y-r.y;return o?(x+=Math.max((a.width-l)/2,0),y+=Math.max((a.height-g)/2,0)):(c=this.getValidScale(Math.min(a.width/l,a.height/g)),x+=(a.width-l*c)/2,y+=(a.height-g*c)/2,e.PointHelper.scaleOf(t,r,c),r.scaleOf(r,c),t.scaleX*=c,t.scaleY*=c),e.PointHelper.move(t,x,y),r.move(x,y),n.set(t,h),r}return n.worldBoxBounds};
|
|
2
2
|
//# sourceMappingURL=view.min.cjs.map
|
package/dist/view.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.min.cjs","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { scaleX } =
|
|
1
|
+
{"version":3,"file":"view.min.cjs","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { x, y, scaleX, scaleY } = zoomLayer.__\n\n if (typeof zoomType === 'string') {\n\n switch (zoomType) {\n case 'in':\n changeScale = getZoomScale(scaleX, 'in')\n break\n case 'out':\n changeScale = getZoomScale(scaleX, 'out')\n break\n case 'fit':\n zoomType = this.boxBounds\n break\n case 'fit-width':\n zoomType = new Bounds(this.boxBounds)\n zoomType.height = 0\n break\n case 'fit-height':\n zoomType = new Bounds(this.boxBounds)\n zoomType.width = 0\n break\n }\n\n } else if (typeof zoomType === 'number') {\n changeScale = zoomType / scaleX\n }\n\n\n if (changeScale) {\n\n changeScale = this.getValidScale(changeScale)\n zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition)\n\n } else if (typeof zoomType === 'object') {\n\n const data = { x, y, scaleX, scaleY }\n const isArray = zoomType instanceof Array\n\n if (isArray || (zoomType as ILeaf).tag) {\n const list: ILeaf[] = isArray ? zoomType as ILeaf[] : [zoomType as ILeaf]\n bounds.setListWithFn(list, LeafBoundsHelper.worldBounds)\n } else {\n const innerBounds = getFixBounds(zoomType as IBoundsData, limitBounds)\n bounds.set(zoomLayer.getWorldBounds(innerBounds))\n }\n\n const { width, height } = bounds\n let moveX = limitBounds.x - bounds.x, moveY = limitBounds.y - bounds.y\n\n if (fixed) {\n\n moveX += Math.max((limitBounds.width - width) / 2, 0)\n moveY += Math.max((limitBounds.height - height) / 2, 0)\n\n } else {\n\n changeScale = this.getValidScale(Math.min(limitBounds.width / width, limitBounds.height / height))\n moveX += (limitBounds.width - width * changeScale) / 2\n moveY += (limitBounds.height - height * changeScale) / 2\n\n PointHelper.scaleOf(data, bounds, changeScale)\n bounds.scaleOf(bounds, changeScale)\n\n data.scaleX *= changeScale\n data.scaleY *= changeScale\n }\n\n PointHelper.move(data, moveX, moveY)\n bounds.move(moveX, moveY)\n\n zoomLayer.set(data, transition)\n\n return bounds\n\n }\n\n return zoomLayer.worldBoxBounds\n\n}"],"names":["getZoomScale","scaleX","type","scale","out","absScale","Math","abs","Plugin","add","Leafer","prototype","zoom","zoomType","padding","fixed","transition","this","killAnimate","zoomLayer","limitBounds","canvas","bounds","clone","shrink","undefined","Bounds","center","x","width","y","height","changeScale","scaleY","__","boxBounds","getValidScale","scaleOfWorld","data","isArray","Array","tag","list","setListWithFn","LeafBoundsHelper","worldBounds","innerBounds","scaleBounds","fix","getFixBounds","set","getWorldBounds","moveX","moveY","max","min","PointHelper","scaleOf","move","worldBoxBounds"],"mappings":"8CAGgB,SAAAA,EAAaC,EAAgBC,GACzC,IAAIC,EAAQ,EACZ,MAAMC,EAAe,QAATF,EAAgBG,EAAWC,KAAK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@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t){"use strict";function e(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}t.Plugin.add("view"),t.Leafer.prototype.zoom=function(i,s,o,h){this.killAnimate();const{zoomLayer:n}=this,a=this.canvas.bounds.clone().shrink(void 0!==s?s:30),c=new t.Bounds,l={x:a.x+a.width/2,y:a.y+a.height/2};let d;const{scaleX:
|
|
1
|
+
!function(t){"use strict";function e(t,e){let i=1;const s="out"===e,o=Math.abs(t);if(o>1){for(;s?i<o:i<=o;)i*=2;s&&(i/=2)}else{for(;s?i>=o:i>o;)i/=2;s||(i*=2)}return i/t}t.Plugin.add("view"),t.Leafer.prototype.zoom=function(i,s,o,h){this.killAnimate();const{zoomLayer:n}=this,a=this.canvas.bounds.clone().shrink(void 0!==s?s:30),c=new t.Bounds,l={x:a.x+a.width/2,y:a.y+a.height/2};let d;const{x:r,y:u,scaleX:f,scaleY:w}=n.__;if("string"==typeof i)switch(i){case"in":d=e(f,"in");break;case"out":d=e(f,"out");break;case"fit":i=this.boxBounds;break;case"fit-width":(i=new t.Bounds(this.boxBounds)).height=0;break;case"fit-height":(i=new t.Bounds(this.boxBounds)).width=0}else"number"==typeof i&&(d=i/f);if(d)d=this.getValidScale(d),n.scaleOfWorld(l,d,d,!1,h);else if("object"==typeof i){const e={x:r,y:u,scaleX:f,scaleY:w},s=i instanceof Array;if(s||i.tag){const e=s?i:[i];c.setListWithFn(e,t.LeafBoundsHelper.worldBounds)}else{const t=function(t,e){let i,{x:s,y:o,width:h,height:n}=t;return n||(n=h*(e.height/e.width),i=!0),h||(h=n*(e.width/e.height),i=!0),i?{x:s,y:o,width:h,height:n}:t}(i,a);c.set(n.getWorldBounds(t))}const{width:l,height:g}=c;let x=a.x-c.x,y=a.y-c.y;return o?(x+=Math.max((a.width-l)/2,0),y+=Math.max((a.height-g)/2,0)):(d=this.getValidScale(Math.min(a.width/l,a.height/g)),x+=(a.width-l*d)/2,y+=(a.height-g*d)/2,t.PointHelper.scaleOf(e,c,d),c.scaleOf(c,d),e.scaleX*=d,e.scaleY*=d),t.PointHelper.move(e,x,y),c.move(x,y),n.set(e,h),c}return n.worldBoxBounds}}(LeaferUI);
|
|
2
2
|
//# sourceMappingURL=view.min.js.map
|
package/dist/view.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.min.js","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { scaleX } =
|
|
1
|
+
{"version":3,"file":"view.min.js","sources":["../../../../../../src/in/packages/view/src/helper.ts","../../../../../../src/in/packages/view/src/index.ts"],"sourcesContent":["import { IBoundsData } from '@leafer-ui/interface'\n\n\nexport function getZoomScale(scaleX: number, type: 'in' | 'out'): number {\n let scale = 1\n const out = type === 'out', absScale = Math.abs(scaleX)\n if (absScale > 1) {\n while (out ? scale < absScale : scale <= absScale) scale *= 2\n if (out) scale /= 2\n } else {\n while (out ? scale >= absScale : scale > absScale) scale /= 2\n if (!out) scale *= 2\n }\n return scale / scaleX\n}\n\nexport function getFixBounds(bounds: IBoundsData, scaleBounds: IBoundsData): IBoundsData {\n let { x, y, width, height } = bounds\n let fix: boolean\n if (!height) height = width * (scaleBounds.height / scaleBounds.width), fix = true\n if (!width) width = height * (scaleBounds.width / scaleBounds.height), fix = true\n return fix ? { x, y, width, height } : bounds\n}","import { ILeaf, IBoundsData, IZoomType, IFourNumber, IPointData, ITransition } from '@leafer-ui/interface'\nimport { Leafer, Bounds, LeafBoundsHelper, Plugin, PointHelper } from '@leafer-ui/draw'\n\nimport { getFixBounds, getZoomScale } from './helper'\n\n\nPlugin.add('view')\n\n\nLeafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fixed?: boolean, transition?: ITransition): IBoundsData {\n\n this.killAnimate()\n\n const { zoomLayer } = this\n const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds()\n const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }\n\n let changeScale: number\n const { x, y, scaleX, scaleY } = zoomLayer.__\n\n if (typeof zoomType === 'string') {\n\n switch (zoomType) {\n case 'in':\n changeScale = getZoomScale(scaleX, 'in')\n break\n case 'out':\n changeScale = getZoomScale(scaleX, 'out')\n break\n case 'fit':\n zoomType = this.boxBounds\n break\n case 'fit-width':\n zoomType = new Bounds(this.boxBounds)\n zoomType.height = 0\n break\n case 'fit-height':\n zoomType = new Bounds(this.boxBounds)\n zoomType.width = 0\n break\n }\n\n } else if (typeof zoomType === 'number') {\n changeScale = zoomType / scaleX\n }\n\n\n if (changeScale) {\n\n changeScale = this.getValidScale(changeScale)\n zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition)\n\n } else if (typeof zoomType === 'object') {\n\n const data = { x, y, scaleX, scaleY }\n const isArray = zoomType instanceof Array\n\n if (isArray || (zoomType as ILeaf).tag) {\n const list: ILeaf[] = isArray ? zoomType as ILeaf[] : [zoomType as ILeaf]\n bounds.setListWithFn(list, LeafBoundsHelper.worldBounds)\n } else {\n const innerBounds = getFixBounds(zoomType as IBoundsData, limitBounds)\n bounds.set(zoomLayer.getWorldBounds(innerBounds))\n }\n\n const { width, height } = bounds\n let moveX = limitBounds.x - bounds.x, moveY = limitBounds.y - bounds.y\n\n if (fixed) {\n\n moveX += Math.max((limitBounds.width - width) / 2, 0)\n moveY += Math.max((limitBounds.height - height) / 2, 0)\n\n } else {\n\n changeScale = this.getValidScale(Math.min(limitBounds.width / width, limitBounds.height / height))\n moveX += (limitBounds.width - width * changeScale) / 2\n moveY += (limitBounds.height - height * changeScale) / 2\n\n PointHelper.scaleOf(data, bounds, changeScale)\n bounds.scaleOf(bounds, changeScale)\n\n data.scaleX *= changeScale\n data.scaleY *= changeScale\n }\n\n PointHelper.move(data, moveX, moveY)\n bounds.move(moveX, moveY)\n\n zoomLayer.set(data, transition)\n\n return bounds\n\n }\n\n return zoomLayer.worldBoxBounds\n\n}"],"names":["getZoomScale","scaleX","type","scale","out","absScale","Math","abs","Plugin","add","Leafer","prototype","zoom","zoomType","padding","fixed","transition","this","killAnimate","zoomLayer","limitBounds","canvas","bounds","clone","shrink","undefined","Bounds","center","x","width","y","height","changeScale","scaleY","__","boxBounds","getValidScale","scaleOfWorld","data","isArray","Array","tag","list","setListWithFn","LeafBoundsHelper","worldBounds","innerBounds","scaleBounds","fix","getFixBounds","set","getWorld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AAKpB,EAAMc,EAAOC,GAC9B/B,EAAOoC,KAAKN,EAAOC,GAEnBlC,EAAU+B,IAAIZ,EAAMtB,GAEbM,EAIX,OAAOH,EAAUwC,cAErB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-in/view",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "@leafer-in/view",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"leaferjs"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@leafer-ui/draw": "^1.
|
|
38
|
-
"@leafer-ui/interface": "^1.
|
|
39
|
-
"@leafer-in/interface": "^1.
|
|
37
|
+
"@leafer-ui/draw": "^1.5.1",
|
|
38
|
+
"@leafer-ui/interface": "^1.5.1",
|
|
39
|
+
"@leafer-in/interface": "^1.5.1"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ Leafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fi
|
|
|
16
16
|
const center: IPointData = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 }
|
|
17
17
|
|
|
18
18
|
let changeScale: number
|
|
19
|
-
const { scaleX } =
|
|
19
|
+
const { x, y, scaleX, scaleY } = zoomLayer.__
|
|
20
20
|
|
|
21
21
|
if (typeof zoomType === 'string') {
|
|
22
22
|
|
|
@@ -52,9 +52,7 @@ Leafer.prototype.zoom = function (zoomType: IZoomType, padding?: IFourNumber, fi
|
|
|
52
52
|
|
|
53
53
|
} else if (typeof zoomType === 'object') {
|
|
54
54
|
|
|
55
|
-
const { x, y, scaleX, scaleY } = zoomLayer
|
|
56
55
|
const data = { x, y, scaleX, scaleY }
|
|
57
|
-
|
|
58
56
|
const isArray = zoomType instanceof Array
|
|
59
57
|
|
|
60
58
|
if (isArray || (zoomType as ILeaf).tag) {
|