@leafer-in/viewport 1.12.2 → 1.12.3
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/viewport.cjs +21 -8
- package/dist/viewport.esm.js +21 -8
- package/dist/viewport.esm.min.js +1 -1
- package/dist/viewport.esm.min.js.map +1 -1
- package/dist/viewport.js +20 -8
- package/dist/viewport.min.cjs +1 -1
- package/dist/viewport.min.cjs.map +1 -1
- package/dist/viewport.min.js +1 -1
- package/dist/viewport.min.js.map +1 -1
- package/package.json +4 -4
- package/src/Leafer.ts +9 -8
- package/src/helper.ts +7 -0
- package/src/type/viewport.ts +19 -2
package/dist/viewport.cjs
CHANGED
|
@@ -2,15 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require("@leafer-ui/core");
|
|
4
4
|
|
|
5
|
+
function getScrollType(leafer) {
|
|
6
|
+
const {scroll: scroll, disabled: disabled} = leafer.app.config.move;
|
|
7
|
+
return !scroll || disabled ? "" : scroll === true ? "free" : scroll;
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
function addViewport(leafer, mergeConfig, custom) {
|
|
6
11
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
7
12
|
if (leafer.isApp || custom) return;
|
|
8
13
|
leafer.__eventIds.push(leafer.on_(core.MoveEvent.BEFORE_MOVE, e => {
|
|
9
14
|
const move = leafer.getValidMove(e.moveX, e.moveY, false);
|
|
15
|
+
if (getScrollType(leafer).includes("limit")) {
|
|
16
|
+
const testMove = leafer.getValidMove(0, 0);
|
|
17
|
+
if (testMove.x || testMove.y) {
|
|
18
|
+
const maxX = 100, maxY = 200, resistance = e.moveType === "drag" ? .3 : .05;
|
|
19
|
+
if (Math.abs(testMove.x) > maxX) move.x = 0; else move.x *= resistance;
|
|
20
|
+
if (Math.abs(testMove.y) > maxY) move.y = 0; else move.y *= resistance;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
10
23
|
leafer.zoomLayer.move(move);
|
|
11
24
|
}), leafer.on_(core.MoveEvent.DRAG_ANIMATE, () => {
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
25
|
+
const testMove = leafer.getValidMove(0, 0);
|
|
26
|
+
if (testMove.x || testMove.y) leafer.interaction.stopDragAnimate();
|
|
14
27
|
}), leafer.on_(core.MoveEvent.END, e => {
|
|
15
28
|
core.LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
16
29
|
}), leafer.on_(core.ZoomEvent.BEFORE_ZOOM, e => {
|
|
@@ -316,15 +329,15 @@ leafer.initType = function(type) {
|
|
|
316
329
|
};
|
|
317
330
|
|
|
318
331
|
leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
|
|
319
|
-
const {
|
|
332
|
+
const {disabled: disabled} = this.app.config.move;
|
|
320
333
|
move.set(moveX, moveY);
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if (
|
|
324
|
-
if (checkLimit &&
|
|
334
|
+
const scrollType = getScrollType(this);
|
|
335
|
+
if (scrollType) {
|
|
336
|
+
if (scrollType.includes("x")) move.y = 0; else if (scrollType.includes("y")) move.x = 0; else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0;
|
|
337
|
+
if (checkLimit && scrollType.includes("limit")) {
|
|
325
338
|
bounds.set(this.__world).addPoint(this.zoomLayer);
|
|
326
339
|
core.DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "auto", move, true);
|
|
327
|
-
if (
|
|
340
|
+
if (scrollType.includes("x")) move.y = 0; else if (scrollType.includes("y")) move.x = 0;
|
|
328
341
|
}
|
|
329
342
|
}
|
|
330
343
|
return {
|
package/dist/viewport.esm.js
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { MoveEvent, LeafHelper, ZoomEvent, DataHelper, Debug, PointHelper, MathHelper, Platform, RotateEvent, Leafer, Bounds, Point, DragBoundsHelper, InteractionBase, isObject, Dragger, isNumber, BoundsHelper, Plugin } from "@leafer-ui/core";
|
|
2
2
|
|
|
3
|
+
function getScrollType(leafer) {
|
|
4
|
+
const {scroll: scroll, disabled: disabled} = leafer.app.config.move;
|
|
5
|
+
return !scroll || disabled ? "" : scroll === true ? "free" : scroll;
|
|
6
|
+
}
|
|
7
|
+
|
|
3
8
|
function addViewport(leafer, mergeConfig, custom) {
|
|
4
9
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
5
10
|
if (leafer.isApp || custom) return;
|
|
6
11
|
leafer.__eventIds.push(leafer.on_(MoveEvent.BEFORE_MOVE, e => {
|
|
7
12
|
const move = leafer.getValidMove(e.moveX, e.moveY, false);
|
|
13
|
+
if (getScrollType(leafer).includes("limit")) {
|
|
14
|
+
const testMove = leafer.getValidMove(0, 0);
|
|
15
|
+
if (testMove.x || testMove.y) {
|
|
16
|
+
const maxX = 100, maxY = 200, resistance = e.moveType === "drag" ? .3 : .05;
|
|
17
|
+
if (Math.abs(testMove.x) > maxX) move.x = 0; else move.x *= resistance;
|
|
18
|
+
if (Math.abs(testMove.y) > maxY) move.y = 0; else move.y *= resistance;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
8
21
|
leafer.zoomLayer.move(move);
|
|
9
22
|
}), leafer.on_(MoveEvent.DRAG_ANIMATE, () => {
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
23
|
+
const testMove = leafer.getValidMove(0, 0);
|
|
24
|
+
if (testMove.x || testMove.y) leafer.interaction.stopDragAnimate();
|
|
12
25
|
}), leafer.on_(MoveEvent.END, e => {
|
|
13
26
|
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
14
27
|
}), leafer.on_(ZoomEvent.BEFORE_ZOOM, e => {
|
|
@@ -314,15 +327,15 @@ leafer.initType = function(type) {
|
|
|
314
327
|
};
|
|
315
328
|
|
|
316
329
|
leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
|
|
317
|
-
const {
|
|
330
|
+
const {disabled: disabled} = this.app.config.move;
|
|
318
331
|
move.set(moveX, moveY);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (
|
|
322
|
-
if (checkLimit &&
|
|
332
|
+
const scrollType = getScrollType(this);
|
|
333
|
+
if (scrollType) {
|
|
334
|
+
if (scrollType.includes("x")) move.y = 0; else if (scrollType.includes("y")) move.x = 0; else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0;
|
|
335
|
+
if (checkLimit && scrollType.includes("limit")) {
|
|
323
336
|
bounds.set(this.__world).addPoint(this.zoomLayer);
|
|
324
337
|
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "auto", move, true);
|
|
325
|
-
if (
|
|
338
|
+
if (scrollType.includes("x")) move.y = 0; else if (scrollType.includes("y")) move.x = 0;
|
|
326
339
|
}
|
|
327
340
|
}
|
|
328
341
|
return {
|
package/dist/viewport.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{MoveEvent as t,LeafHelper as e,ZoomEvent as o,DataHelper as a,Debug as n,PointHelper as i,MathHelper as s,Platform as r,RotateEvent as c,Leafer as m,Bounds as l,Point as h,DragBoundsHelper as u,InteractionBase as g,isObject as d,Dragger as v,isNumber as f,BoundsHelper as p,Plugin as
|
|
1
|
+
import{MoveEvent as t,LeafHelper as e,ZoomEvent as o,DataHelper as a,Debug as n,PointHelper as i,MathHelper as s,Platform as r,RotateEvent as c,Leafer as m,Bounds as l,Point as h,DragBoundsHelper as u,InteractionBase as g,isObject as d,Dragger as v,isNumber as f,BoundsHelper as p,Plugin as y}from"@leafer-ui/core";function D(t){const{scroll:e,disabled:o}=t.app.config.move;return!e||o?"":!0===e?"free":e}function O(a,n,i){M(a.parentApp?a.parentApp:a,n),a.isApp||i||a.__eventIds.push(a.on_(t.BEFORE_MOVE,t=>{const e=a.getValidMove(t.moveX,t.moveY,!1);if(D(a).includes("limit")){const o=a.getValidMove(0,0);if(o.x||o.y){const a=100,n=200,i="drag"===t.moveType?.3:.05;Math.abs(o.x)>a?e.x=0:e.x*=i,Math.abs(o.y)>n?e.y=0:e.y*=i}}a.zoomLayer.move(e)}),a.on_(t.DRAG_ANIMATE,()=>{const t=a.getValidMove(0,0);(t.x||t.y)&&a.interaction.stopDragAnimate()}),a.on_(t.END,t=>{e.animateMove(a.zoomLayer,a.getValidMove(t.moveX,t.moveY))}),a.on_(o.BEFORE_ZOOM,t=>{const{zoomLayer:e}=a,o=a.getValidScale(t.scale);1!==o&&e.scaleOfWorld(t,o)}))}function M(t,e){const o={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};e&&a.assign(o,e),a.assign(t.config,o,t.userConfig)}const b=n.get("LeaferTypeCreator"),T={list:{},register(t,e){x[t]&&b.repeat(t),x[t]=e},run(t,e){const o=x[t];o&&o(e)}},{list:x,register:E}=T;E("viewport",O),E("custom",function(t){O(t,null,!0)}),E("design",function(t){O(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),E("document",function(t){O(t,{zoom:{min:1},move:{scroll:"limit"}})});const z={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const e=t[0],o=t[1],a=i.getCenter(e.from,o.from),n=i.getCenter(e.to,o.to),s={x:n.x-a.x,y:n.y-a.y},r=i.getDistance(e.from,o.from);return{move:s,scale:i.getDistance(e.to,o.to)/r,rotation:i.getRotation(e.from,o.from,e.to,o.to),center:n}},getType(t,e){const o=Math.hypot(t.move.x,t.move.y)/(e.move||5),a=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return o<1&&a<1&&n<1?"none":o>=a&&o>=n?"move":a>=n?"zoom":"rotate"},detect(t,e){const{state:o}=j,a=j.getType(t,e);if(o.totalData||(o.startTime=Date.now(),o.center=t.center),j.add(t,o.totalData),o.totalData=t,a===o.type){if(o.typeCount++,o.typeCount>=(e.count||3)&&"none"!==a)return a}else o.type=a,o.typeCount=1;return Date.now()-o.startTime>=(e.time||160)?j.getType(o.totalData,e):"none"},add(t,e){e&&(i.move(t.move,e.move),t.scale*=e.scale,t.rotation+=e.rotation,t.center=e.center)},reset(){const{state:t}=j;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},j=z,{abs:R,max:X}=Math,{sign:Y,within:A}=s,S={getMove(t,e){let{moveSpeed:o}=e,{deltaX:a,deltaY:n}=t;t.shiftKey&&!a&&(a=n,n=0);const i=R(a),s=R(n);return i>50&&(a=X(50,i/3)*Y(a)),s>50&&(n=X(50,s/3)*Y(n)),{x:-a*o*2,y:-n*o*2}},getScale(t,e){let o,a=1,{zoomMode:n,zoomSpeed:i}=e;const s=t.deltaY||t.deltaX;if(n?(o="mouse"===n||!t.deltaX&&(r.intWheelDeltaY?Math.abs(s)>17:Math.ceil(s)!==s),(t.shiftKey||t.metaKey||t.ctrlKey)&&(o=!0)):o=!t.shiftKey&&(t.metaKey||t.ctrlKey),o){i=A(i,0,1);const o=t.deltaY?e.delta.y:e.delta.x,n=A(1-R(s)/(4*o)*i,.5,2);a=s>0?n:1/n}return a}};let _,w,C,V;class K{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(e){const{interaction:o}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),_=0,w=0,this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0,totalX:_,totalY:w}),o.emit(t.START,this.moveData)),e.path=this.moveData.path,e.totalX=_+=e.moveX,e.totalY=w+=e.moveY,o.emit(t.BEFORE_MOVE,e),o.emit(t.MOVE,e),this.transformEndWait()}zoom(t){const{interaction:e}=this;this.zoomData||(this.setPath(t),C=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:C}),e.emit(o.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=C*=t.scale,e.emit(o.BEFORE_ZOOM,t),e.emit(o.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:e}=this;this.rotateData||(this.setPath(t),V=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:V}),e.emit(c.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=V+=t.rotation,e.emit(c.BEFORE_ROTATE,t),e.emit(c.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:o}=e.selector.getByPoint(t,e.hitRadius);t.path=o,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:e,moveData:a,zoomData:n,rotateData:i}=this;a&&e.emit(t.END,Object.assign(Object.assign({},a),{totalX:_,totalY:w})),n&&e.emit(o.END,Object.assign(Object.assign({},n),{totalScale:C})),i&&e.emit(c.END,Object.assign(Object.assign({},i),{totalRotation:V})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const W=m.prototype,B=new l,k=new h;function L(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function P(t,e){return Object.assign(Object.assign({},e),{scale:t})}W.initType=function(t){T.run(t,this)},W.getValidMove=function(t,e,o=!0){const{disabled:a}=this.app.config.move;k.set(t,e);const n=D(this);return n&&(n.includes("x")?k.y=0:n.includes("y")?k.x=0:Math.abs(k.x)>Math.abs(k.y)?k.y=0:k.x=0,o&&n.includes("limit")&&(B.set(this.__world).addPoint(this.zoomLayer),u.getValidMove(B,this.canvas.bounds,"auto",k,!0),n.includes("x")?k.y=0:n.includes("y")&&(k.x=0))),{x:a?0:k.x,y:a?0:k.y}},W.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:o,max:a,disabled:n}=this.app.config.zoom,i=Math.abs(e*t);return o&&i<o?t=o/e:a&&i>a&&(t=a/e),n?1:t};const N=g.prototype;N.createTransformer=function(){this.transformer=new K(this)},N.move=function(t){this.transformer.move(t)},N.zoom=function(t){this.transformer.zoom(t)},N.rotate=function(t){this.transformer.rotate(t)},N.transformEnd=function(){this.transformer.transformEnd()},N.wheel=function(t){const{wheel:e,pointer:o}=this.config,{posDeltaSpeed:a,negDeltaSpeed:n}=e;if(e.disabled)return;t.deltaX>0?a&&(t.deltaX*=a):n&&(t.deltaX*=n),t.deltaY>0?a&&(t.deltaY*=a):n&&(t.deltaY*=n);const s=e.getScale?e.getScale(t,e):S.getScale(t,e);if(1!==s)this.zoom(P(s,t));else{const a=e.getMove?e.getMove(t,e):S.getMove(t,e);o.snap&&i.round(a),this.move(L(a,t))}},N.multiTouch=function(t,e){const{disabled:o,singleGesture:a}=this.config.multiTouch;if(o)return;this.pointerWaitCancel();let n=z.getData(e),{moving:i,zooming:s,rotating:r}=this.transformer;if(a){if(!this.transformer.transforming){switch(z.detect(n,d(a)?a:{})){case"move":i=!0;break;case"zoom":s=!0;break;case"rotate":r=!0;break;default:return}z.reset()}i||(n.center=z.state.center)}else i=s=r=!0;var c,m;Object.assign(t,n.center),t.multiTouch=!0,r&&this.rotate((c=n.rotation,m=t,Object.assign(Object.assign({},m),{rotation:c}))),s&&this.zoom(P(n.scale,t)),i&&this.move(L(n.move,t))};const F=v.prototype,{abs:I,min:G,max:Z,hypot:H}=Math;F.checkDragEndAnimate=function(e){const{interaction:o}=this,a=this.canAnimate&&this.moving&&o.m.dragAnimate;if(a){const n=f(a)?a:.95,s=.15,r=150;let c,m,l,h=0,u=0,g=0,d=0,v=3;const{dragDataList:p}=this,y=p.length;for(let t=y-1;t>=Z(y-3,0)&&(l=p[t],!(l.time&&Date.now()-l.time>100));t--)c=v--,h+=l.moveX*c,u+=l.moveY*c,d+=c,m=H(l.moveX,l.moveY),m>g&&(g=m);if(d&&(h/=d,u/=d),g>8){const t=1.15+G((g-8)/17,1)*(1.6-1.15);h*=t,u*=t}const D=Z(I(h),I(u));D>r&&(m=r/D,h*=m,u*=m);const O=()=>{if(h*=n,u*=n,e=Object.assign({},e),I(h)<s&&I(u)<s)return this.dragEndReal(e);i.move(e,h,u),this.drag(e),this.animate(O),o.emit(t.DRAG_ANIMATE,e)};this.animate(O)}return a},F.animate=function(t,e){const o=t||this.animateWait;o&&this.interaction.target.nextRender(o,null,e),this.animateWait=t},F.stopAnimate=function(){this.animate(null,"off"),this.interaction.target.nextRender(()=>{this.dragData&&this.dragEndReal(this.dragData)})},F.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},F.autoMoveOnDragOut=function(t){const{interaction:e,downData:o,canDragOut:a}=this,{autoDistance:n,dragOut:s}=e.m;if(!s||!a||!n)return;const r=e.shrinkCanvasBounds,{x:c,y:m}=r,l=p.maxX(r),h=p.maxY(r),u=t.x<c?n:l<t.x?-n:0,g=t.y<m?n:h<t.y?-n:0;let d=0,v=0;this.autoMoveTimer=setInterval(()=>{d+=u,v+=g,i.move(o,u,g),i.move(this.dragData,u,g),e.move(Object.assign(Object.assign({},t),{moveX:u,moveY:g,totalX:d,totalY:v,moveType:"drag"})),e.pointerMoveReal(t)},10)},F.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},y.add("viewport");export{T as LeaferTypeCreator,z as MultiTouchHelper,K as Transformer,S as WheelEventHelper,O as addViewport,M as addViewportConfig};
|
|
2
2
|
//# sourceMappingURL=viewport.esm.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.esm.min.js","sources":["../../../../../../src/in/packages/viewport/src/type/viewport.ts","../../../../../../src/in/packages/viewport/src/LeaferTypeCreator.ts","../../../../../../src/in/packages/viewport/src/type/custom.ts","../../../../../../src/in/packages/viewport/src/type/design.ts","../../../../../../src/in/packages/viewport/src/type/document.ts","../../../../../../src/in/packages/viewport/src/interaction/MultiTouchHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/WheelEventHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/Transformer.ts","../../../../../../src/in/packages/viewport/src/Leafer.ts","../../../../../../src/in/packages/viewport/src/interaction/Interaction.ts","../../../../../../src/in/packages/viewport/src/interaction/Dragger.ts","../../../../../../src/in/packages/viewport/src/index.ts"],"sourcesContent":["import { ILeaferBase, ILeaferConfig } from '@leafer-ui/interface'\n\nimport { MoveEvent, ZoomEvent, DataHelper, LeafHelper } from '@leafer-ui/core'\n\n\nexport function addViewport(leafer: ILeaferBase, mergeConfig?: ILeaferConfig, custom?: boolean): void {\n addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig)\n if (leafer.isApp || custom) return\n\n leafer.__eventIds.push(\n leafer.on_(MoveEvent.BEFORE_MOVE, (e: MoveEvent) => {\n const move = leafer.getValidMove(e.moveX, e.moveY, false)\n leafer.zoomLayer.move(move)\n }),\n leafer.on_(MoveEvent.DRAG_ANIMATE, () => {\n const move = leafer.getValidMove(0, 0)\n if (move.x || move.y) leafer.interaction.stopDragAnimate()\n }),\n leafer.on_(MoveEvent.END, (e: MoveEvent) => {\n LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY))\n }),\n leafer.on_(ZoomEvent.BEFORE_ZOOM, (e: ZoomEvent) => {\n const { zoomLayer } = leafer\n const changeScale = leafer.getValidScale(e.scale)\n if (changeScale !== 1) zoomLayer.scaleOfWorld(e, changeScale)\n })\n )\n}\n\nexport function addViewportConfig(leafer: ILeaferBase, mergeConfig?: ILeaferConfig): void {\n const viewportConfig: ILeaferConfig = {\n wheel: { preventDefault: true },\n touch: { preventDefault: true },\n pointer: { preventDefaultMenu: true }\n }\n if (mergeConfig) DataHelper.assign(viewportConfig, mergeConfig)\n DataHelper.assign(leafer.config, viewportConfig, leafer.userConfig)\n}","import { ILeaferBase, ILeaferTypeList, ILeaferTypeFunction } from '@leafer-ui/interface'\n\nimport { Debug } from '@leafer-ui/core'\n\nimport { addViewport } from './type/viewport'\nimport { custom } from './type/custom'\nimport { design } from './type/design'\nimport { document } from './type/document'\n\n\nconst debug = Debug.get('LeaferTypeCreator')\n\nexport const LeaferTypeCreator = {\n\n list: {} as ILeaferTypeList,\n\n register(name: string, fn: ILeaferTypeFunction): void {\n list[name] && debug.repeat(name)\n list[name] = fn\n },\n\n run(name: string, leafer: ILeaferBase): void {\n const fn = list[name]\n fn && fn(leafer)\n }\n\n}\n\nconst { list, register } = LeaferTypeCreator\n\nregister('viewport', addViewport)\nregister('custom', custom)\nregister('design', design)\nregister('document', document)","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function custom(leafer: ILeaferBase): void {\n addViewport(leafer, null, true)\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function design(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: {\n min: 0.01,\n max: 256\n },\n move: {\n holdSpaceKey: true,\n holdMiddleKey: true,\n }\n })\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function document(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: { min: 1 },\n move: { scroll: 'limit' }\n })\n}\n","import { IMultiTouchData, IKeepTouchData, IGestureType, IPointData, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { PointHelper } from '@leafer-ui/core'\n\n\nexport const MultiTouchHelper = {\n\n state: { // 单一手势识别状态\n type: 'none' as IGestureType,\n typeCount: 0,\n startTime: 0,\n totalData: null as IMultiTouchData,\n center: {} as IPointData\n },\n\n getData(list: IKeepTouchData[]): IMultiTouchData {\n const a = list[0], b = list[1]\n const lastCenter = PointHelper.getCenter(a.from, b.from)\n const center = PointHelper.getCenter(a.to, b.to)\n const move = { x: center.x - lastCenter.x, y: center.y - lastCenter.y }\n\n const lastDistance = PointHelper.getDistance(a.from, b.from)\n const distance = PointHelper.getDistance(a.to, b.to)\n const scale = distance / lastDistance\n\n const rotation = PointHelper.getRotation(a.from, b.from, a.to, b.to)\n return { move, scale, rotation, center }\n },\n\n getType(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const moveScore = Math.hypot(data.move.x, data.move.y) / (config.move || 5)\n const scaleScore = Math.abs(data.scale - 1) / (config.scale || 0.03)\n const rotateScore = Math.abs(data.rotation) / (config.rotation || 2)\n\n if (moveScore < 1 && scaleScore < 1 && rotateScore < 1) return 'none'\n if (moveScore >= scaleScore && moveScore >= rotateScore) return 'move'\n if (scaleScore >= rotateScore) return 'zoom'\n return 'rotate'\n },\n\n // 识别单一手势\n detect(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const { state } = M\n const type = M.getType(data, config)\n\n if (!state.totalData) {\n state.startTime = Date.now()\n state.center = data.center\n }\n\n M.add(data, state.totalData)\n state.totalData = data\n\n if (type === state.type) { // 连续多帧一样的类型才进行锁定\n state.typeCount++\n if (state.typeCount >= (config.count || 3) && type !== 'none') return type\n } else {\n state.type = type\n state.typeCount = 1\n }\n\n if ((Date.now() - state.startTime) >= (config.time || 160)) return M.getType(state.totalData, config) // 限制最长识别时间\n\n return 'none'\n },\n\n add(data: IMultiTouchData, add: IMultiTouchData): void {\n if (!add) return\n PointHelper.move(data.move, add.move)\n data.scale *= add.scale\n data.rotation += add.rotation\n data.center = add.center\n },\n\n reset() {\n const { state } = M\n state.type = 'none'\n state.typeCount = 0\n state.startTime = 0\n state.totalData = null\n }\n\n}\n\nconst M = MultiTouchHelper","import { IPointData, IWheelEvent, IWheelConfig } from '@leafer-ui/interface'\n\nimport { MathHelper, Platform } from '@leafer-ui/core'\n\n\nconst { abs, max } = Math, { sign, within } = MathHelper\n\nexport const WheelEventHelper = {\n\n getMove(event: IWheelEvent, config: IWheelConfig): IPointData {\n let { moveSpeed } = config\n let { deltaX, deltaY } = event\n if (event.shiftKey && !deltaX) { // Window\n deltaX = deltaY\n deltaY = 0\n }\n const absX = abs(deltaX), absY = abs(deltaY)\n if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX)\n if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY)\n return { x: -deltaX * moveSpeed * 2, y: -deltaY * moveSpeed * 2 }\n },\n\n getScale(event: IWheelEvent, config: IWheelConfig): number {\n\n let zoom: boolean\n let scale = 1\n let { zoomMode, zoomSpeed } = config\n\n const delta = event.deltaY || event.deltaX\n\n if (zoomMode) {\n // mac 触摸板滚动手势的deltaY是整数, 鼠标滚动/触摸板缩放的deltaY有小数点, firfox鼠标滚动为整数,为18或19的倍数\n // windows 始终是整数\n zoom = (zoomMode === 'mouse') ? true : (!event.deltaX && (Platform.intWheelDeltaY ? Math.abs(delta) > 17 : Math.ceil(delta) !== delta))\n if (event.shiftKey || event.metaKey || event.ctrlKey) zoom = true\n } else {\n zoom = !event.shiftKey && (event.metaKey || event.ctrlKey)\n }\n\n if (zoom) {\n zoomSpeed = within(zoomSpeed, 0, 1)\n const min = event.deltaY ? config.delta.y : config.delta.x\n const absScale = within(1 - abs(delta) / (min * 4) * zoomSpeed, 0.5, 2)\n scale = delta > 0 ? absScale : 1 / absScale // 让 scale 放大、缩小可以定位在有规律的刻度上\n }\n\n return scale\n }\n\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, ITimer } from '@leafer-ui/interface'\n\nimport { InteractionBase, MoveEvent, ZoomEvent, RotateEvent } from '@leafer-ui/core'\n\n\nlet totalX: number, totalY: number, totalScale: number, totalRotation: number\n\nexport class Transformer {\n\n public get transforming(): boolean { return this.moving || this.zooming || this.rotating }\n public get moving(): boolean { return !!this.moveData }\n public get zooming(): boolean { return !!this.zoomData }\n public get rotating(): boolean { return !!this.rotateData }\n\n public moveData: IMoveEvent\n public zoomData: IZoomEvent\n public rotateData: IRotateEvent\n\n protected interaction: InteractionBase\n protected transformTimer: ITimer\n\n constructor(interaction: InteractionBase) {\n this.interaction = interaction\n }\n\n public move(data: IMoveEvent): void {\n const { interaction } = this\n if (!data.moveType) data.moveType = 'move'\n\n if (!this.moveData) {\n this.setPath(data)\n totalX = 0, totalY = 0\n this.moveData = { ...data, moveX: 0, moveY: 0, totalX, totalY }\n interaction.emit(MoveEvent.START, this.moveData)\n }\n\n data.path = this.moveData.path\n data.totalX = totalX = totalX + data.moveX\n data.totalY = totalY = totalY + data.moveY\n interaction.emit(MoveEvent.BEFORE_MOVE, data)\n interaction.emit(MoveEvent.MOVE, data)\n\n this.transformEndWait()\n }\n\n public zoom(data: IZoomEvent): void {\n const { interaction } = this\n\n if (!this.zoomData) {\n this.setPath(data)\n totalScale = 1\n this.zoomData = { ...data, scale: 1, totalScale }\n interaction.emit(ZoomEvent.START, this.zoomData)\n }\n\n data.path = this.zoomData.path\n data.totalScale = totalScale = totalScale * data.scale\n interaction.emit(ZoomEvent.BEFORE_ZOOM, data)\n interaction.emit(ZoomEvent.ZOOM, data)\n\n this.transformEndWait()\n }\n\n public rotate(data: IRotateEvent): void {\n const { interaction } = this\n\n if (!this.rotateData) {\n this.setPath(data)\n totalRotation = 0\n this.rotateData = { ...data, rotation: 0, totalRotation }\n interaction.emit(RotateEvent.START, this.rotateData)\n }\n\n data.path = this.rotateData.path\n data.totalRotation = totalRotation = totalRotation + data.rotation\n interaction.emit(RotateEvent.BEFORE_ROTATE, data)\n interaction.emit(RotateEvent.ROTATE, data)\n\n this.transformEndWait()\n }\n\n public setPath(data: any): void {\n const { interaction } = this\n const { path } = interaction.selector.getByPoint(data, interaction.hitRadius)\n data.path = path\n interaction.cancelHover()\n }\n\n protected transformEndWait(): void {\n clearTimeout(this.transformTimer)\n this.transformTimer = setTimeout(() => {\n this.transformEnd()\n }, this.interaction.p.transformTime)\n }\n\n public transformEnd(): void {\n const { interaction, moveData, zoomData, rotateData } = this\n if (moveData) interaction.emit(MoveEvent.END, { ...moveData, totalX, totalY } as IMoveEvent)\n if (zoomData) interaction.emit(ZoomEvent.END, { ...zoomData, totalScale } as IZoomEvent)\n if (rotateData) interaction.emit(RotateEvent.END, { ...rotateData, totalRotation } as IRotateEvent)\n this.reset()\n }\n\n public reset(): void {\n this.zoomData = this.moveData = this.rotateData = null\n }\n\n public destroy(): void {\n this.reset()\n }\n}","import { ILeaferType, IPointData } from '@leafer-ui/interface'\n\nimport { Leafer, Bounds, Point, DragBoundsHelper } from '@leafer-ui/core'\n\nimport { LeaferTypeCreator } from './LeaferTypeCreator'\n\n\nconst leafer = Leafer.prototype\nconst bounds = new Bounds(), move = new Point()\n\nleafer.initType = function (type: ILeaferType) {\n LeaferTypeCreator.run(type, this)\n}\n\nleafer.getValidMove = function (moveX: number, moveY: number, checkLimit = true): IPointData {\n const { scroll, disabled } = this.app.config.move\n move.set(moveX, moveY)\n\n if (scroll) {\n const type = scroll === true ? '' : scroll\n\n if (type.includes('x')) move.y = 0\n else if (type.includes('y')) move.x = 0\n else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0\n\n if (checkLimit && type.includes('limit')) {\n bounds.set(this.__world).addPoint(this.zoomLayer as IPointData)\n DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, 'auto', move, true)\n if (type.includes('x')) move.y = 0\n else if (type.includes('y')) move.x = 0\n }\n }\n\n return { x: disabled ? 0 : move.x, y: disabled ? 0 : move.y }\n}\n\nleafer.getValidScale = function (changeScale: number): number {\n const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale)\n if (min && absScale < min) changeScale = min / scaleX\n else if (max && absScale > max) changeScale = max / scaleX\n return disabled ? 1 : changeScale // fix 不能过滤小数位\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, IKeepTouchData, IPointData, IEvent, IPointerEvent, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { InteractionBase, PointHelper, isObject } from '@leafer-ui/core'\n\nimport { WheelEventHelper } from './WheelEventHelper'\nimport { Transformer } from './Transformer'\nimport { MultiTouchHelper } from './MultiTouchHelper'\n\n\nfunction getMoveEventData(move: IPointData, event: IEvent): IMoveEvent {\n return { ...event, moveX: move.x, moveY: move.y } as IMoveEvent\n}\n\nfunction getRotateEventData(rotation: number, event: IEvent): IRotateEvent {\n return { ...event, rotation } as IRotateEvent\n}\n\nfunction getZoomEventData(scale: number, event: IEvent): IZoomEvent {\n return { ...event, scale, } as IZoomEvent\n}\n\n\nconst interaction = InteractionBase.prototype\n\ninteraction.createTransformer = function (): void {\n this.transformer = new Transformer(this)\n}\n\ninteraction.move = function (data: IMoveEvent): void {\n this.transformer.move(data)\n}\n\ninteraction.zoom = function (data: IZoomEvent): void {\n this.transformer.zoom(data)\n}\n\ninteraction.rotate = function (data: IRotateEvent): void {\n this.transformer.rotate(data)\n}\n\ninteraction.transformEnd = function (): void {\n this.transformer.transformEnd()\n}\n\n\ninteraction.wheel = function (data: IWheelEvent): void {\n const { wheel, pointer } = this.config, { posDeltaSpeed, negDeltaSpeed } = wheel\n if (wheel.disabled) return\n\n if (data.deltaX > 0) posDeltaSpeed && (data.deltaX *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaX *= negDeltaSpeed)\n\n if (data.deltaY > 0) posDeltaSpeed && (data.deltaY *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaY *= negDeltaSpeed)\n\n const scale = wheel.getScale ? wheel.getScale(data, wheel) : WheelEventHelper.getScale(data, wheel)\n if (scale !== 1) this.zoom(getZoomEventData(scale, data))\n else {\n const move = wheel.getMove ? wheel.getMove(data, wheel) : WheelEventHelper.getMove(data, wheel)\n if (pointer.snap) PointHelper.round(move)\n this.move(getMoveEventData(move, data))\n }\n}\n\n\ninteraction.multiTouch = function (data: IPointerEvent, list: IKeepTouchData[]): void {\n const { disabled, singleGesture } = this.config.multiTouch\n if (disabled) return\n this.pointerWaitCancel()\n\n let gestureData = MultiTouchHelper.getData(list)\n let { moving, zooming, rotating } = this.transformer\n\n if (singleGesture) {\n\n if (!this.transformer.transforming) {\n\n const type = MultiTouchHelper.detect(gestureData, isObject(singleGesture) ? singleGesture : {} as ISingleGestureConfig)\n\n switch (type) {\n case 'move': moving = true; break\n case 'zoom': zooming = true; break\n case 'rotate': rotating = true; break\n default: return\n }\n\n MultiTouchHelper.reset()\n\n }\n\n if (!moving) gestureData.center = MultiTouchHelper.state.center\n\n } else moving = zooming = rotating = true\n\n Object.assign(data, gestureData.center)\n data.multiTouch = true\n\n if (rotating) this.rotate(getRotateEventData(gestureData.rotation, data))\n if (zooming) this.zoom(getZoomEventData(gestureData.scale, data))\n if (moving) this.move(getMoveEventData(gestureData.move, data))\n}","import { IPointerEvent, IFunction, IDragEvent } from '@leafer-ui/interface'\n\nimport { Dragger, BoundsHelper, PointHelper, MoveEvent, isNumber } from '@leafer-ui/core'\n\n\nconst dragger = Dragger.prototype\nconst { abs, min, max, hypot } = Math\n\ndragger.checkDragEndAnimate = function (data: IPointerEvent): boolean | number {\n const { interaction } = this\n const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate\n\n if (dragAnimate) {\n\n const inertia = isNumber(dragAnimate) ? dragAnimate : 0.95\n const stopMove = 0.15\n const maxMove = 150\n\n let moveX = 0, moveY = 0, flickSpeed = 0 // 快速滑动加速\n let totalWeight = 0, weight: number, w = 3, s: number, frame: IDragEvent\n\n const { dragDataList } = this, len = dragDataList.length\n for (let i = len - 1; i >= max(len - 3, 0); i--) {\n frame = dragDataList[i]\n if (frame.time && (Date.now() - frame.time > 100)) break\n weight = w--\n\n moveX += frame.moveX * weight\n moveY += frame.moveY * weight\n totalWeight += weight\n\n s = hypot(frame.moveX, frame.moveY)\n if (s > flickSpeed) flickSpeed = s\n }\n\n if (totalWeight) moveX /= totalWeight, moveY /= totalWeight\n\n if (flickSpeed > 8) {\n const t = min((flickSpeed - 8) / 17, 1)\n const boost = 1.15 + t * (1.6 - 1.15)\n moveX *= boost\n moveY *= boost\n }\n\n const maxAbs = max(abs(moveX), abs(moveY))\n if (maxAbs > maxMove) {\n s = maxMove / maxAbs\n moveX *= s\n moveY *= s\n }\n\n const step = () => {\n moveX *= inertia\n moveY *= inertia\n\n data = { ...data }\n if (abs(moveX) < stopMove && abs(moveY) < stopMove) return this.dragEndReal(data)\n\n PointHelper.move(data, moveX, moveY)\n this.drag(data)\n\n this.animate(step)\n interaction.emit(MoveEvent.DRAG_ANIMATE, data)\n }\n\n this.animate(step)\n }\n\n return dragAnimate\n}\n\ndragger.animate = function (func?: IFunction, off?: 'off'): void { // dragEnd animation\n const animateWait = func || this.animateWait\n if (animateWait) this.interaction.target.nextRender(animateWait, null, off)\n this.animateWait = func\n}\n\ndragger.stopAnimate = function (): void {\n this.animate(null, 'off')\n this.interaction.target.nextRender(() => {\n if (this.dragData) this.dragEndReal(this.dragData)\n })\n}\n\ndragger.checkDragOut = function (data: IPointerEvent): void {\n const { interaction } = this\n this.autoMoveCancel()\n if (this.dragging && !interaction.shrinkCanvasBounds.hitPoint(data)) this.autoMoveOnDragOut(data)\n}\n\ndragger.autoMoveOnDragOut = function (data: IPointerEvent): void {\n const { interaction, downData, canDragOut } = this\n const { autoDistance, dragOut } = interaction.m\n if (!dragOut || !canDragOut || !autoDistance) return\n\n const bounds = interaction.shrinkCanvasBounds\n const { x, y } = bounds\n const right = BoundsHelper.maxX(bounds)\n const bottom = BoundsHelper.maxY(bounds)\n\n const moveX = data.x < x ? autoDistance : (right < data.x ? -autoDistance : 0)\n const moveY = data.y < y ? autoDistance : (bottom < data.y ? -autoDistance : 0)\n let totalX = 0, totalY = 0\n\n this.autoMoveTimer = setInterval(() => {\n totalX += moveX\n totalY += moveY\n\n PointHelper.move(downData, moveX, moveY)\n PointHelper.move(this.dragData, moveX, moveY)\n\n interaction.move({ ...data, moveX, moveY, totalX, totalY, moveType: 'drag' })\n interaction.pointerMoveReal(data)\n }, 10)\n}\n\ndragger.autoMoveCancel = function (): void {\n if (this.autoMoveTimer) {\n clearInterval(this.autoMoveTimer)\n this.autoMoveTimer = 0\n }\n}","export { LeaferTypeCreator } from './LeaferTypeCreator'\nexport { addViewport, addViewportConfig } from './type/viewport'\nexport { MultiTouchHelper } from './interaction/MultiTouchHelper'\nexport { WheelEventHelper } from './interaction/WheelEventHelper'\nexport { Transformer } from './interaction/Transformer'\n\nimport { Plugin } from '@leafer-ui/core'\n\nimport './Leafer'\nimport './interaction/Interaction'\nimport './interaction/Dragger'\n\nPlugin.add('viewport')"],"names":["addViewport","leafer","mergeConfig","custom","addViewportConfig","parentApp","isApp","__eventIds","push","on_","MoveEvent","BEFORE_MOVE","e","move","getValidMove","moveX","moveY","zoomLayer","DRAG_ANIMATE","x","y","interaction","stopDragAnimate","END","LeafHelper","animateMove","ZoomEvent","BEFORE_ZOOM","changeScale","getValidScale","scale","scaleOfWorld","viewportConfig","wheel","preventDefault","touch","pointer","preventDefaultMenu","DataHelper","assign","config","userConfig","debug","Debug","get","LeaferTypeCreator","list","register","name","fn","repeat","run","zoom","min","max","holdSpaceKey","holdMiddleKey","scroll","MultiTouchHelper","state","type","typeCount","startTime","totalData","center","getData","a","b","lastCenter","PointHelper","getCenter","from","to","lastDistance","getDistance","rotation","getRotation","getType","data","moveScore","Math","hypot","scaleScore","abs","rotateScore","detect","M","Date","now","add","count","time","reset","sign","within","MathHelper","WheelEventHelper","getMove","event","moveSpeed","deltaX","deltaY","shiftKey","absX","absY","getScale","zoomMode","zoomSpeed","delta","Platform","intWheelDeltaY","ceil","metaKey","ctrlKey","absScale","totalX","totalY","totalScale","totalRotation","Transformer","transforming","this","moving","zooming","rotating","moveData","zoomData","rotateData","constructor","moveType","setPath","Object","emit","START","path","MOVE","transformEndWait","ZOOM","rotate","RotateEvent","BEFORE_ROTATE","ROTATE","selector","getByPoint","hitRadius","cancelHover","clearTimeout","transformTimer","setTimeout","transformEnd","p","transformTime","destroy","Leafer","prototype","bounds","Bounds","Point","getMoveEventData","getZoomEventData","initType","checkLimit","disabled","app","set","includes","__world","addPoint","DragBoundsHelper","canvas","scaleX","__","InteractionBase","createTransformer","transformer","posDeltaSpeed","negDeltaSpeed","snap","round","multiTouch","singleGesture","pointerWaitCancel","gestureData","isObject","dragger","Dragger","checkDragEndAnimate","dragAnimate","canAnimate","m","inertia","isNumber","stopMove","maxMove","weight","s","frame","flickSpeed","totalWeight","w","dragDataList","len","length","i","boost","maxAbs","step","dragEndReal","drag","animate","func","off","animateWait","target","nextRender","stopAnimate","dragData","checkDragOut","autoMoveCancel","dragging","shrinkCanvasBounds","hitPoint","autoMoveOnDragOut","downData","canDragOut","autoDistance","dragOut","right","BoundsHelper","maxX","bottom","maxY","autoMoveTimer","setInterval","pointerMoveReal","clearInterval","Plugin"],"mappings":"oUAKgBA,EAAYC,EAAqBC,EAA6BC,GAC1EC,EAAkBH,EAAOI,UAAYJ,EAAOI,UAAYJ,EAAQC,GAC5DD,EAAOK,OAASH,GAEpBF,EAAOM,WAAWC,KACdP,EAAOQ,IAAIC,EAAUC,YAAcC,IAC/B,MAAMC,EAAOZ,EAAOa,aAAaF,EAAEG,MAAOH,EAAEI,OAAO,GACnDf,EAAOgB,UAAUJ,KAAKA,KAE1BZ,EAAOQ,IAAIC,EAAUQ,aAAc,KAC/B,MAAML,EAAOZ,EAAOa,aAAa,EAAG,IAChCD,EAAKM,GAAKN,EAAKO,IAAGnB,EAAOoB,YAAYC,oBAE7CrB,EAAOQ,IAAIC,EAAUa,IAAMX,IACvBY,EAAWC,YAAYxB,EAAOgB,UAAWhB,EAAOa,aAAaF,EAAEG,MAAOH,EAAEI,UAE5Ef,EAAOQ,IAAIiB,EAAUC,YAAcf,IAC/B,MAAMK,UAAEA,GAAchB,EAChB2B,EAAc3B,EAAO4B,cAAcjB,EAAEkB,OACvB,IAAhBF,GAAmBX,EAAUc,aAAanB,EAAGgB,KAG7D,CAEM,SAAUxB,EAAkBH,EAAqBC,GACnD,MAAM8B,EAAgC,CAClCC,MAAO,CAAEC,gBAAgB,GACzBC,MAAO,CAAED,gBAAgB,GACzBE,QAAS,CAAEC,oBAAoB,IAE/BnC,GAAaoC,EAAWC,OAAOP,EAAgB9B,GACnDoC,EAAWC,OAAOtC,EAAOuC,OAAQR,EAAgB/B,EAAOwC,WAC5D,CC3BA,MAAMC,EAAQC,EAAMC,IAAI,qBAEXC,EAAoB,CAE7BC,KAAM,CAAA,EAEN,QAAAC,CAAS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AAiB,WACjBjG,KAAK+G,gBACLG,cAAclH,KAAK+G,eACnB/G,KAAK+G,cAAgB,EAE7B,EC7GAI,EAAOnJ,IAAI"}
|
|
1
|
+
{"version":3,"file":"viewport.esm.min.js","sources":["../../../../../../src/in/packages/viewport/src/helper.ts","../../../../../../src/in/packages/viewport/src/type/viewport.ts","../../../../../../src/in/packages/viewport/src/LeaferTypeCreator.ts","../../../../../../src/in/packages/viewport/src/type/custom.ts","../../../../../../src/in/packages/viewport/src/type/design.ts","../../../../../../src/in/packages/viewport/src/type/document.ts","../../../../../../src/in/packages/viewport/src/interaction/MultiTouchHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/WheelEventHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/Transformer.ts","../../../../../../src/in/packages/viewport/src/Leafer.ts","../../../../../../src/in/packages/viewport/src/interaction/Interaction.ts","../../../../../../src/in/packages/viewport/src/interaction/Dragger.ts","../../../../../../src/in/packages/viewport/src/index.ts"],"sourcesContent":["import { ILeaferBase } from '@leafer-ui/interface'\n\n\nexport function getScrollType(leafer: ILeaferBase): string {\n const { scroll, disabled } = leafer.app.config.move\n return (!scroll || disabled) ? '' : (scroll === true ? 'free' : scroll)\n}","import { ILeaferBase, ILeaferConfig } from '@leafer-ui/interface'\n\nimport { MoveEvent, ZoomEvent, DataHelper, LeafHelper } from '@leafer-ui/core'\n\nimport { getScrollType } from '../helper'\n\n\nexport function addViewport(leafer: ILeaferBase, mergeConfig?: ILeaferConfig, custom?: boolean): void {\n addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig)\n if (leafer.isApp || custom) return\n\n leafer.__eventIds.push(\n leafer.on_(MoveEvent.BEFORE_MOVE, (e: MoveEvent) => {\n const move = leafer.getValidMove(e.moveX, e.moveY, false)\n\n // check limit\n if (getScrollType(leafer).includes('limit')) {\n const testMove = leafer.getValidMove(0, 0)\n if (testMove.x || testMove.y) {\n const maxX = 100, maxY = 200, resistance = e.moveType === 'drag' ? 0.3 : 0.05\n\n if (Math.abs(testMove.x) > maxX) move.x = 0\n else move.x *= resistance\n\n if (Math.abs(testMove.y) > maxY) move.y = 0\n else move.y *= resistance\n }\n }\n\n leafer.zoomLayer.move(move)\n }),\n leafer.on_(MoveEvent.DRAG_ANIMATE, () => {\n const testMove = leafer.getValidMove(0, 0)\n if (testMove.x || testMove.y) leafer.interaction.stopDragAnimate()\n }),\n leafer.on_(MoveEvent.END, (e: MoveEvent) => {\n LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY))\n }),\n leafer.on_(ZoomEvent.BEFORE_ZOOM, (e: ZoomEvent) => {\n const { zoomLayer } = leafer\n const changeScale = leafer.getValidScale(e.scale)\n if (changeScale !== 1) zoomLayer.scaleOfWorld(e, changeScale)\n })\n )\n}\n\nexport function addViewportConfig(leafer: ILeaferBase, mergeConfig?: ILeaferConfig): void {\n const viewportConfig: ILeaferConfig = {\n wheel: { preventDefault: true },\n touch: { preventDefault: true },\n pointer: { preventDefaultMenu: true }\n }\n if (mergeConfig) DataHelper.assign(viewportConfig, mergeConfig)\n DataHelper.assign(leafer.config, viewportConfig, leafer.userConfig)\n}","import { ILeaferBase, ILeaferTypeList, ILeaferTypeFunction } from '@leafer-ui/interface'\n\nimport { Debug } from '@leafer-ui/core'\n\nimport { addViewport } from './type/viewport'\nimport { custom } from './type/custom'\nimport { design } from './type/design'\nimport { document } from './type/document'\n\n\nconst debug = Debug.get('LeaferTypeCreator')\n\nexport const LeaferTypeCreator = {\n\n list: {} as ILeaferTypeList,\n\n register(name: string, fn: ILeaferTypeFunction): void {\n list[name] && debug.repeat(name)\n list[name] = fn\n },\n\n run(name: string, leafer: ILeaferBase): void {\n const fn = list[name]\n fn && fn(leafer)\n }\n\n}\n\nconst { list, register } = LeaferTypeCreator\n\nregister('viewport', addViewport)\nregister('custom', custom)\nregister('design', design)\nregister('document', document)","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function custom(leafer: ILeaferBase): void {\n addViewport(leafer, null, true)\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function design(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: {\n min: 0.01,\n max: 256\n },\n move: {\n holdSpaceKey: true,\n holdMiddleKey: true,\n }\n })\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function document(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: { min: 1 },\n move: { scroll: 'limit' }\n })\n}\n","import { IMultiTouchData, IKeepTouchData, IGestureType, IPointData, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { PointHelper } from '@leafer-ui/core'\n\n\nexport const MultiTouchHelper = {\n\n state: { // 单一手势识别状态\n type: 'none' as IGestureType,\n typeCount: 0,\n startTime: 0,\n totalData: null as IMultiTouchData,\n center: {} as IPointData\n },\n\n getData(list: IKeepTouchData[]): IMultiTouchData {\n const a = list[0], b = list[1]\n const lastCenter = PointHelper.getCenter(a.from, b.from)\n const center = PointHelper.getCenter(a.to, b.to)\n const move = { x: center.x - lastCenter.x, y: center.y - lastCenter.y }\n\n const lastDistance = PointHelper.getDistance(a.from, b.from)\n const distance = PointHelper.getDistance(a.to, b.to)\n const scale = distance / lastDistance\n\n const rotation = PointHelper.getRotation(a.from, b.from, a.to, b.to)\n return { move, scale, rotation, center }\n },\n\n getType(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const moveScore = Math.hypot(data.move.x, data.move.y) / (config.move || 5)\n const scaleScore = Math.abs(data.scale - 1) / (config.scale || 0.03)\n const rotateScore = Math.abs(data.rotation) / (config.rotation || 2)\n\n if (moveScore < 1 && scaleScore < 1 && rotateScore < 1) return 'none'\n if (moveScore >= scaleScore && moveScore >= rotateScore) return 'move'\n if (scaleScore >= rotateScore) return 'zoom'\n return 'rotate'\n },\n\n // 识别单一手势\n detect(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const { state } = M\n const type = M.getType(data, config)\n\n if (!state.totalData) {\n state.startTime = Date.now()\n state.center = data.center\n }\n\n M.add(data, state.totalData)\n state.totalData = data\n\n if (type === state.type) { // 连续多帧一样的类型才进行锁定\n state.typeCount++\n if (state.typeCount >= (config.count || 3) && type !== 'none') return type\n } else {\n state.type = type\n state.typeCount = 1\n }\n\n if ((Date.now() - state.startTime) >= (config.time || 160)) return M.getType(state.totalData, config) // 限制最长识别时间\n\n return 'none'\n },\n\n add(data: IMultiTouchData, add: IMultiTouchData): void {\n if (!add) return\n PointHelper.move(data.move, add.move)\n data.scale *= add.scale\n data.rotation += add.rotation\n data.center = add.center\n },\n\n reset() {\n const { state } = M\n state.type = 'none'\n state.typeCount = 0\n state.startTime = 0\n state.totalData = null\n }\n\n}\n\nconst M = MultiTouchHelper","import { IPointData, IWheelEvent, IWheelConfig } from '@leafer-ui/interface'\n\nimport { MathHelper, Platform } from '@leafer-ui/core'\n\n\nconst { abs, max } = Math, { sign, within } = MathHelper\n\nexport const WheelEventHelper = {\n\n getMove(event: IWheelEvent, config: IWheelConfig): IPointData {\n let { moveSpeed } = config\n let { deltaX, deltaY } = event\n if (event.shiftKey && !deltaX) { // Window\n deltaX = deltaY\n deltaY = 0\n }\n const absX = abs(deltaX), absY = abs(deltaY)\n if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX)\n if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY)\n return { x: -deltaX * moveSpeed * 2, y: -deltaY * moveSpeed * 2 }\n },\n\n getScale(event: IWheelEvent, config: IWheelConfig): number {\n\n let zoom: boolean\n let scale = 1\n let { zoomMode, zoomSpeed } = config\n\n const delta = event.deltaY || event.deltaX\n\n if (zoomMode) {\n // mac 触摸板滚动手势的deltaY是整数, 鼠标滚动/触摸板缩放的deltaY有小数点, firfox鼠标滚动为整数,为18或19的倍数\n // windows 始终是整数\n zoom = (zoomMode === 'mouse') ? true : (!event.deltaX && (Platform.intWheelDeltaY ? Math.abs(delta) > 17 : Math.ceil(delta) !== delta))\n if (event.shiftKey || event.metaKey || event.ctrlKey) zoom = true\n } else {\n zoom = !event.shiftKey && (event.metaKey || event.ctrlKey)\n }\n\n if (zoom) {\n zoomSpeed = within(zoomSpeed, 0, 1)\n const min = event.deltaY ? config.delta.y : config.delta.x\n const absScale = within(1 - abs(delta) / (min * 4) * zoomSpeed, 0.5, 2)\n scale = delta > 0 ? absScale : 1 / absScale // 让 scale 放大、缩小可以定位在有规律的刻度上\n }\n\n return scale\n }\n\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, ITimer } from '@leafer-ui/interface'\n\nimport { InteractionBase, MoveEvent, ZoomEvent, RotateEvent } from '@leafer-ui/core'\n\n\nlet totalX: number, totalY: number, totalScale: number, totalRotation: number\n\nexport class Transformer {\n\n public get transforming(): boolean { return this.moving || this.zooming || this.rotating }\n public get moving(): boolean { return !!this.moveData }\n public get zooming(): boolean { return !!this.zoomData }\n public get rotating(): boolean { return !!this.rotateData }\n\n public moveData: IMoveEvent\n public zoomData: IZoomEvent\n public rotateData: IRotateEvent\n\n protected interaction: InteractionBase\n protected transformTimer: ITimer\n\n constructor(interaction: InteractionBase) {\n this.interaction = interaction\n }\n\n public move(data: IMoveEvent): void {\n const { interaction } = this\n if (!data.moveType) data.moveType = 'move'\n\n if (!this.moveData) {\n this.setPath(data)\n totalX = 0, totalY = 0\n this.moveData = { ...data, moveX: 0, moveY: 0, totalX, totalY }\n interaction.emit(MoveEvent.START, this.moveData)\n }\n\n data.path = this.moveData.path\n data.totalX = totalX = totalX + data.moveX\n data.totalY = totalY = totalY + data.moveY\n interaction.emit(MoveEvent.BEFORE_MOVE, data)\n interaction.emit(MoveEvent.MOVE, data)\n\n this.transformEndWait()\n }\n\n public zoom(data: IZoomEvent): void {\n const { interaction } = this\n\n if (!this.zoomData) {\n this.setPath(data)\n totalScale = 1\n this.zoomData = { ...data, scale: 1, totalScale }\n interaction.emit(ZoomEvent.START, this.zoomData)\n }\n\n data.path = this.zoomData.path\n data.totalScale = totalScale = totalScale * data.scale\n interaction.emit(ZoomEvent.BEFORE_ZOOM, data)\n interaction.emit(ZoomEvent.ZOOM, data)\n\n this.transformEndWait()\n }\n\n public rotate(data: IRotateEvent): void {\n const { interaction } = this\n\n if (!this.rotateData) {\n this.setPath(data)\n totalRotation = 0\n this.rotateData = { ...data, rotation: 0, totalRotation }\n interaction.emit(RotateEvent.START, this.rotateData)\n }\n\n data.path = this.rotateData.path\n data.totalRotation = totalRotation = totalRotation + data.rotation\n interaction.emit(RotateEvent.BEFORE_ROTATE, data)\n interaction.emit(RotateEvent.ROTATE, data)\n\n this.transformEndWait()\n }\n\n public setPath(data: any): void {\n const { interaction } = this\n const { path } = interaction.selector.getByPoint(data, interaction.hitRadius)\n data.path = path\n interaction.cancelHover()\n }\n\n protected transformEndWait(): void {\n clearTimeout(this.transformTimer)\n this.transformTimer = setTimeout(() => {\n this.transformEnd()\n }, this.interaction.p.transformTime)\n }\n\n public transformEnd(): void {\n const { interaction, moveData, zoomData, rotateData } = this\n if (moveData) interaction.emit(MoveEvent.END, { ...moveData, totalX, totalY } as IMoveEvent)\n if (zoomData) interaction.emit(ZoomEvent.END, { ...zoomData, totalScale } as IZoomEvent)\n if (rotateData) interaction.emit(RotateEvent.END, { ...rotateData, totalRotation } as IRotateEvent)\n this.reset()\n }\n\n public reset(): void {\n this.zoomData = this.moveData = this.rotateData = null\n }\n\n public destroy(): void {\n this.reset()\n }\n}","import { ILeaferType, IPointData } from '@leafer-ui/interface'\n\nimport { Leafer, Bounds, Point, DragBoundsHelper } from '@leafer-ui/core'\n\nimport { LeaferTypeCreator } from './LeaferTypeCreator'\nimport { getScrollType } from './helper'\n\n\nconst leafer = Leafer.prototype\nconst bounds = new Bounds(), move = new Point()\n\nleafer.initType = function (type: ILeaferType) {\n LeaferTypeCreator.run(type, this)\n}\n\nleafer.getValidMove = function (moveX: number, moveY: number, checkLimit = true): IPointData {\n const { disabled } = this.app.config.move\n move.set(moveX, moveY)\n\n const scrollType = getScrollType(this)\n if (scrollType) {\n\n if (scrollType.includes('x')) move.y = 0\n else if (scrollType.includes('y')) move.x = 0\n else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0\n\n if (checkLimit && scrollType.includes('limit')) {\n bounds.set(this.__world).addPoint(this.zoomLayer as IPointData)\n DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, 'auto', move, true)\n if (scrollType.includes('x')) move.y = 0\n else if (scrollType.includes('y')) move.x = 0\n }\n }\n\n return { x: disabled ? 0 : move.x, y: disabled ? 0 : move.y }\n}\n\nleafer.getValidScale = function (changeScale: number): number {\n const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale)\n if (min && absScale < min) changeScale = min / scaleX\n else if (max && absScale > max) changeScale = max / scaleX\n return disabled ? 1 : changeScale // fix 不能过滤小数位\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, IKeepTouchData, IPointData, IEvent, IPointerEvent, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { InteractionBase, PointHelper, isObject } from '@leafer-ui/core'\n\nimport { WheelEventHelper } from './WheelEventHelper'\nimport { Transformer } from './Transformer'\nimport { MultiTouchHelper } from './MultiTouchHelper'\n\n\nfunction getMoveEventData(move: IPointData, event: IEvent): IMoveEvent {\n return { ...event, moveX: move.x, moveY: move.y } as IMoveEvent\n}\n\nfunction getRotateEventData(rotation: number, event: IEvent): IRotateEvent {\n return { ...event, rotation } as IRotateEvent\n}\n\nfunction getZoomEventData(scale: number, event: IEvent): IZoomEvent {\n return { ...event, scale, } as IZoomEvent\n}\n\n\nconst interaction = InteractionBase.prototype\n\ninteraction.createTransformer = function (): void {\n this.transformer = new Transformer(this)\n}\n\ninteraction.move = function (data: IMoveEvent): void {\n this.transformer.move(data)\n}\n\ninteraction.zoom = function (data: IZoomEvent): void {\n this.transformer.zoom(data)\n}\n\ninteraction.rotate = function (data: IRotateEvent): void {\n this.transformer.rotate(data)\n}\n\ninteraction.transformEnd = function (): void {\n this.transformer.transformEnd()\n}\n\n\ninteraction.wheel = function (data: IWheelEvent): void {\n const { wheel, pointer } = this.config, { posDeltaSpeed, negDeltaSpeed } = wheel\n if (wheel.disabled) return\n\n if (data.deltaX > 0) posDeltaSpeed && (data.deltaX *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaX *= negDeltaSpeed)\n\n if (data.deltaY > 0) posDeltaSpeed && (data.deltaY *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaY *= negDeltaSpeed)\n\n const scale = wheel.getScale ? wheel.getScale(data, wheel) : WheelEventHelper.getScale(data, wheel)\n if (scale !== 1) this.zoom(getZoomEventData(scale, data))\n else {\n const move = wheel.getMove ? wheel.getMove(data, wheel) : WheelEventHelper.getMove(data, wheel)\n if (pointer.snap) PointHelper.round(move)\n this.move(getMoveEventData(move, data))\n }\n}\n\n\ninteraction.multiTouch = function (data: IPointerEvent, list: IKeepTouchData[]): void {\n const { disabled, singleGesture } = this.config.multiTouch\n if (disabled) return\n this.pointerWaitCancel()\n\n let gestureData = MultiTouchHelper.getData(list)\n let { moving, zooming, rotating } = this.transformer\n\n if (singleGesture) {\n\n if (!this.transformer.transforming) {\n\n const type = MultiTouchHelper.detect(gestureData, isObject(singleGesture) ? singleGesture : {} as ISingleGestureConfig)\n\n switch (type) {\n case 'move': moving = true; break\n case 'zoom': zooming = true; break\n case 'rotate': rotating = true; break\n default: return\n }\n\n MultiTouchHelper.reset()\n\n }\n\n if (!moving) gestureData.center = MultiTouchHelper.state.center\n\n } else moving = zooming = rotating = true\n\n Object.assign(data, gestureData.center)\n data.multiTouch = true\n\n if (rotating) this.rotate(getRotateEventData(gestureData.rotation, data))\n if (zooming) this.zoom(getZoomEventData(gestureData.scale, data))\n if (moving) this.move(getMoveEventData(gestureData.move, data))\n}","import { IPointerEvent, IFunction, IDragEvent } from '@leafer-ui/interface'\n\nimport { Dragger, BoundsHelper, PointHelper, MoveEvent, isNumber } from '@leafer-ui/core'\n\n\nconst dragger = Dragger.prototype\nconst { abs, min, max, hypot } = Math\n\ndragger.checkDragEndAnimate = function (data: IPointerEvent): boolean | number {\n const { interaction } = this\n const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate\n\n if (dragAnimate) {\n\n const inertia = isNumber(dragAnimate) ? dragAnimate : 0.95\n const stopMove = 0.15\n const maxMove = 150\n\n let moveX = 0, moveY = 0, flickSpeed = 0 // 快速滑动加速\n let totalWeight = 0, weight: number, w = 3, s: number, frame: IDragEvent\n\n const { dragDataList } = this, len = dragDataList.length\n for (let i = len - 1; i >= max(len - 3, 0); i--) {\n frame = dragDataList[i]\n if (frame.time && (Date.now() - frame.time > 100)) break\n weight = w--\n\n moveX += frame.moveX * weight\n moveY += frame.moveY * weight\n totalWeight += weight\n\n s = hypot(frame.moveX, frame.moveY)\n if (s > flickSpeed) flickSpeed = s\n }\n\n if (totalWeight) moveX /= totalWeight, moveY /= totalWeight\n\n if (flickSpeed > 8) {\n const t = min((flickSpeed - 8) / 17, 1)\n const boost = 1.15 + t * (1.6 - 1.15)\n moveX *= boost\n moveY *= boost\n }\n\n const maxAbs = max(abs(moveX), abs(moveY))\n if (maxAbs > maxMove) {\n s = maxMove / maxAbs\n moveX *= s\n moveY *= s\n }\n\n const step = () => {\n moveX *= inertia\n moveY *= inertia\n\n data = { ...data }\n if (abs(moveX) < stopMove && abs(moveY) < stopMove) return this.dragEndReal(data)\n\n PointHelper.move(data, moveX, moveY)\n this.drag(data)\n\n this.animate(step)\n interaction.emit(MoveEvent.DRAG_ANIMATE, data)\n }\n\n this.animate(step)\n }\n\n return dragAnimate\n}\n\ndragger.animate = function (func?: IFunction, off?: 'off'): void { // dragEnd animation\n const animateWait = func || this.animateWait\n if (animateWait) this.interaction.target.nextRender(animateWait, null, off)\n this.animateWait = func\n}\n\ndragger.stopAnimate = function (): void {\n this.animate(null, 'off')\n this.interaction.target.nextRender(() => {\n if (this.dragData) this.dragEndReal(this.dragData)\n })\n}\n\ndragger.checkDragOut = function (data: IPointerEvent): void {\n const { interaction } = this\n this.autoMoveCancel()\n if (this.dragging && !interaction.shrinkCanvasBounds.hitPoint(data)) this.autoMoveOnDragOut(data)\n}\n\ndragger.autoMoveOnDragOut = function (data: IPointerEvent): void {\n const { interaction, downData, canDragOut } = this\n const { autoDistance, dragOut } = interaction.m\n if (!dragOut || !canDragOut || !autoDistance) return\n\n const bounds = interaction.shrinkCanvasBounds\n const { x, y } = bounds\n const right = BoundsHelper.maxX(bounds)\n const bottom = BoundsHelper.maxY(bounds)\n\n const moveX = data.x < x ? autoDistance : (right < data.x ? -autoDistance : 0)\n const moveY = data.y < y ? autoDistance : (bottom < data.y ? -autoDistance : 0)\n let totalX = 0, totalY = 0\n\n this.autoMoveTimer = setInterval(() => {\n totalX += moveX\n totalY += moveY\n\n PointHelper.move(downData, moveX, moveY)\n PointHelper.move(this.dragData, moveX, moveY)\n\n interaction.move({ ...data, moveX, moveY, totalX, totalY, moveType: 'drag' })\n interaction.pointerMoveReal(data)\n }, 10)\n}\n\ndragger.autoMoveCancel = function (): void {\n if (this.autoMoveTimer) {\n clearInterval(this.autoMoveTimer)\n this.autoMoveTimer = 0\n }\n}","export { LeaferTypeCreator } from './LeaferTypeCreator'\nexport { addViewport, addViewportConfig } from './type/viewport'\nexport { MultiTouchHelper } from './interaction/MultiTouchHelper'\nexport { WheelEventHelper } from './interaction/WheelEventHelper'\nexport { Transformer } from './interaction/Transformer'\n\nimport { Plugin } from '@leafer-ui/core'\n\nimport './Leafer'\nimport './interaction/Interaction'\nimport './interaction/Dragger'\n\nPlugin.add('viewport')"],"names":["getScrollType","leafer","scroll","disabled","app","config","move","addViewport","mergeConfig","custom","addViewportConfig","parentApp","isApp","__eventIds","push","on_","MoveEvent","BEFORE_MOVE","e","getValidMove","moveX","moveY","includes","testMove","x","y","maxX","maxY","resistance","moveType","Math","abs","zoomLayer","DRAG_ANIMATE","interaction","stopDragAnimate","END","LeafHelper","animateMove","ZoomEvent","BEFORE_ZOOM","changeScale","getValidScale","scale","scaleOfWorld","viewportConfig","wheel","preventDefault","touch","pointer","preventDefaultMenu","DataHelper","assign","userConfig","debug","Debug","get","LeaferTypeCreator","list","register","name","fn","repeat","run","zoom","min","max","holdSpaceKey","holdMiddleKey","MultiTouchHelper","state","type","typeCount","startTime","totalData","center","getData","a","b","lastCenter","PointHelper","getCenter","from","to","lastDistance","getDistance","rotation","getRotation","getType","data","moveScore","hypot","scaleScore","rotateScore","detect","M","Date","now","add","count","time","reset","sign","within","MathHelper","WheelEventHelper","getMove","event","moveSpeed","deltaX","deltaY","shiftKey","absX","absY","getScale","zoomMode","zoomSpeed","delta","Platform","intWheelDeltaY","ceil","metaKey","ctrlKey","absScale","totalX","totalY","totalScale","totalRotation","Transformer","transforming","this","moving","zooming","rotating","moveData","zoomData","rotateData","constructor","setPath","Object","emit","START","path","MOVE","transformEndWait","ZOOM","rotate","RotateEvent","BEFORE_ROTATE","ROTATE","selector","getByPoint","hitRadius","cancelHover","clearTimeout","transformTimer","setTimeout","transformEnd","p","transformTime","destroy","Leafer","prototype","bounds","Bounds","Point","getMoveEventData","getZoomEventData","initType","checkLimit","set","scrollType","__world","addPoint","DragBoundsHelper","canvas","scaleX","__","InteractionBase","createTransformer","transformer","posDeltaSpeed","negDeltaSpeed","snap","round","multiTouch","singleGesture","pointerWaitCancel","gestureData","isObject","dragger","Dragger","checkDragEndAnimate","dragAnimate","canAnimate","m","inertia","isNumber","stopMove","maxMove","weight","s","frame","flickSpeed","totalWeight","w","dragDataList","len","length","i","boost","maxAbs","step","dragEndReal","drag","animate","func","off","animateWait","target","nextRender","stopAnimate","dragData","checkDragOut","autoMoveCancel","dragging","shrinkCanvasBounds","hitPoint","autoMoveOnDragOut","downData","canDragOut","autoDistance","dragOut","right","BoundsHelper","bottom","autoMoveTimer","setInterval","pointerMoveReal","clearInterval","Plugin"],"mappings":"2TAGM,SAAUA,EAAcC,GAC1B,MAAMC,OAAEA,EAAMC,SAAEA,GAAa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,EAAY1E,KAAK4H,KAAK4F,SAAU1M,EAAOC,GAEvCa,EAAY5B,KAAIqI,OAAAvF,OAAAuF,OAAAvF,OAAA,GAAMqC,GAAI,CAAErE,QAAOC,QAAOuG,SAAQC,SAAQhG,SAAU,UACpEK,EAAY4M,gBAAgBrJ,IAC7B,GACP,EAEAqG,EAAQkC,eAAiB,WACjB9F,KAAK0G,gBACLG,cAAc7G,KAAK0G,eACnB1G,KAAK0G,cAAgB,EAE7B,EC7GAI,EAAO9I,IAAI"}
|
package/dist/viewport.js
CHANGED
|
@@ -2,15 +2,27 @@ this.LeaferIN = this.LeaferIN || {};
|
|
|
2
2
|
|
|
3
3
|
this.LeaferIN.viewport = function(exports, core) {
|
|
4
4
|
"use strict";
|
|
5
|
+
function getScrollType(leafer) {
|
|
6
|
+
const {scroll: scroll, disabled: disabled} = leafer.app.config.move;
|
|
7
|
+
return !scroll || disabled ? "" : scroll === true ? "free" : scroll;
|
|
8
|
+
}
|
|
5
9
|
function addViewport(leafer, mergeConfig, custom) {
|
|
6
10
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
7
11
|
if (leafer.isApp || custom) return;
|
|
8
12
|
leafer.__eventIds.push(leafer.on_(core.MoveEvent.BEFORE_MOVE, e => {
|
|
9
13
|
const move = leafer.getValidMove(e.moveX, e.moveY, false);
|
|
14
|
+
if (getScrollType(leafer).includes("limit")) {
|
|
15
|
+
const testMove = leafer.getValidMove(0, 0);
|
|
16
|
+
if (testMove.x || testMove.y) {
|
|
17
|
+
const maxX = 100, maxY = 200, resistance = e.moveType === "drag" ? .3 : .05;
|
|
18
|
+
if (Math.abs(testMove.x) > maxX) move.x = 0; else move.x *= resistance;
|
|
19
|
+
if (Math.abs(testMove.y) > maxY) move.y = 0; else move.y *= resistance;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
10
22
|
leafer.zoomLayer.move(move);
|
|
11
23
|
}), leafer.on_(core.MoveEvent.DRAG_ANIMATE, () => {
|
|
12
|
-
const
|
|
13
|
-
if (
|
|
24
|
+
const testMove = leafer.getValidMove(0, 0);
|
|
25
|
+
if (testMove.x || testMove.y) leafer.interaction.stopDragAnimate();
|
|
14
26
|
}), leafer.on_(core.MoveEvent.END, e => {
|
|
15
27
|
core.LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY));
|
|
16
28
|
}), leafer.on_(core.ZoomEvent.BEFORE_ZOOM, e => {
|
|
@@ -295,15 +307,15 @@ this.LeaferIN.viewport = function(exports, core) {
|
|
|
295
307
|
LeaferTypeCreator.run(type, this);
|
|
296
308
|
};
|
|
297
309
|
leafer.getValidMove = function(moveX, moveY, checkLimit = true) {
|
|
298
|
-
const {
|
|
310
|
+
const {disabled: disabled} = this.app.config.move;
|
|
299
311
|
move.set(moveX, moveY);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
if (
|
|
303
|
-
if (checkLimit &&
|
|
312
|
+
const scrollType = getScrollType(this);
|
|
313
|
+
if (scrollType) {
|
|
314
|
+
if (scrollType.includes("x")) move.y = 0; else if (scrollType.includes("y")) move.x = 0; else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0;
|
|
315
|
+
if (checkLimit && scrollType.includes("limit")) {
|
|
304
316
|
bounds.set(this.__world).addPoint(this.zoomLayer);
|
|
305
317
|
core.DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, "auto", move, true);
|
|
306
|
-
if (
|
|
318
|
+
if (scrollType.includes("x")) move.y = 0; else if (scrollType.includes("y")) move.x = 0;
|
|
307
319
|
}
|
|
308
320
|
}
|
|
309
321
|
return {
|
package/dist/viewport.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer-ui/core");function e(e,
|
|
1
|
+
"use strict";var t=require("@leafer-ui/core");function e(t){const{scroll:e,disabled:o}=t.app.config.move;return!e||o?"":!0===e?"free":e}function o(o,n,i){a(o.parentApp?o.parentApp:o,n),o.isApp||i||o.__eventIds.push(o.on_(t.MoveEvent.BEFORE_MOVE,t=>{const a=o.getValidMove(t.moveX,t.moveY,!1);if(e(o).includes("limit")){const e=o.getValidMove(0,0);if(e.x||e.y){const o=100,n=200,i="drag"===t.moveType?.3:.05;Math.abs(e.x)>o?a.x=0:a.x*=i,Math.abs(e.y)>n?a.y=0:a.y*=i}}o.zoomLayer.move(a)}),o.on_(t.MoveEvent.DRAG_ANIMATE,()=>{const t=o.getValidMove(0,0);(t.x||t.y)&&o.interaction.stopDragAnimate()}),o.on_(t.MoveEvent.END,e=>{t.LeafHelper.animateMove(o.zoomLayer,o.getValidMove(e.moveX,e.moveY))}),o.on_(t.ZoomEvent.BEFORE_ZOOM,t=>{const{zoomLayer:e}=o,a=o.getValidScale(t.scale);1!==a&&e.scaleOfWorld(t,a)}))}function a(e,o){const a={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};o&&t.DataHelper.assign(a,o),t.DataHelper.assign(e.config,a,e.userConfig)}const n=t.Debug.get("LeaferTypeCreator"),i={list:{},register(t,e){s[t]&&n.repeat(t),s[t]=e},run(t,e){const o=s[t];o&&o(e)}},{list:s,register:r}=i;r("viewport",o),r("custom",function(t){o(t,null,!0)}),r("design",function(t){o(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),r("document",function(t){o(t,{zoom:{min:1},move:{scroll:"limit"}})});const c={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(e){const o=e[0],a=e[1],n=t.PointHelper.getCenter(o.from,a.from),i=t.PointHelper.getCenter(o.to,a.to),s={x:i.x-n.x,y:i.y-n.y},r=t.PointHelper.getDistance(o.from,a.from);return{move:s,scale:t.PointHelper.getDistance(o.to,a.to)/r,rotation:t.PointHelper.getRotation(o.from,a.from,o.to,a.to),center:i}},getType(t,e){const o=Math.hypot(t.move.x,t.move.y)/(e.move||5),a=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return o<1&&a<1&&n<1?"none":o>=a&&o>=n?"move":a>=n?"zoom":"rotate"},detect(t,e){const{state:o}=m,a=m.getType(t,e);if(o.totalData||(o.startTime=Date.now(),o.center=t.center),m.add(t,o.totalData),o.totalData=t,a===o.type){if(o.typeCount++,o.typeCount>=(e.count||3)&&"none"!==a)return a}else o.type=a,o.typeCount=1;return Date.now()-o.startTime>=(e.time||160)?m.getType(o.totalData,e):"none"},add(e,o){o&&(t.PointHelper.move(e.move,o.move),e.scale*=o.scale,e.rotation+=o.rotation,e.center=o.center)},reset(){const{state:t}=m;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},m=c,{abs:l,max:h}=Math,{sign:u,within:v}=t.MathHelper,g={getMove(t,e){let{moveSpeed:o}=e,{deltaX:a,deltaY:n}=t;t.shiftKey&&!a&&(a=n,n=0);const i=l(a),s=l(n);return i>50&&(a=h(50,i/3)*u(a)),s>50&&(n=h(50,s/3)*u(n)),{x:-a*o*2,y:-n*o*2}},getScale(e,o){let a,n=1,{zoomMode:i,zoomSpeed:s}=o;const r=e.deltaY||e.deltaX;if(i?(a="mouse"===i||!e.deltaX&&(t.Platform.intWheelDeltaY?Math.abs(r)>17:Math.ceil(r)!==r),(e.shiftKey||e.metaKey||e.ctrlKey)&&(a=!0)):a=!e.shiftKey&&(e.metaKey||e.ctrlKey),a){s=v(s,0,1);const t=e.deltaY?o.delta.y:o.delta.x,a=v(1-l(r)/(4*t)*s,.5,2);n=r>0?a:1/a}return n}};let d,p,f,y;class D{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(e){const{interaction:o}=this;e.moveType||(e.moveType="move"),this.moveData||(this.setPath(e),d=0,p=0,this.moveData=Object.assign(Object.assign({},e),{moveX:0,moveY:0,totalX:d,totalY:p}),o.emit(t.MoveEvent.START,this.moveData)),e.path=this.moveData.path,e.totalX=d+=e.moveX,e.totalY=p+=e.moveY,o.emit(t.MoveEvent.BEFORE_MOVE,e),o.emit(t.MoveEvent.MOVE,e),this.transformEndWait()}zoom(e){const{interaction:o}=this;this.zoomData||(this.setPath(e),f=1,this.zoomData=Object.assign(Object.assign({},e),{scale:1,totalScale:f}),o.emit(t.ZoomEvent.START,this.zoomData)),e.path=this.zoomData.path,e.totalScale=f*=e.scale,o.emit(t.ZoomEvent.BEFORE_ZOOM,e),o.emit(t.ZoomEvent.ZOOM,e),this.transformEndWait()}rotate(e){const{interaction:o}=this;this.rotateData||(this.setPath(e),y=0,this.rotateData=Object.assign(Object.assign({},e),{rotation:0,totalRotation:y}),o.emit(t.RotateEvent.START,this.rotateData)),e.path=this.rotateData.path,e.totalRotation=y+=e.rotation,o.emit(t.RotateEvent.BEFORE_ROTATE,e),o.emit(t.RotateEvent.ROTATE,e),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:o}=e.selector.getByPoint(t,e.hitRadius);t.path=o,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:e,moveData:o,zoomData:a,rotateData:n}=this;o&&e.emit(t.MoveEvent.END,Object.assign(Object.assign({},o),{totalX:d,totalY:p})),a&&e.emit(t.ZoomEvent.END,Object.assign(Object.assign({},a),{totalScale:f})),n&&e.emit(t.RotateEvent.END,Object.assign(Object.assign({},n),{totalRotation:y})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const M=t.Leafer.prototype,E=new t.Bounds,O=new t.Point;function b(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function T(t,e){return Object.assign(Object.assign({},e),{scale:t})}M.initType=function(t){i.run(t,this)},M.getValidMove=function(o,a,n=!0){const{disabled:i}=this.app.config.move;O.set(o,a);const s=e(this);return s&&(s.includes("x")?O.y=0:s.includes("y")?O.x=0:Math.abs(O.x)>Math.abs(O.y)?O.y=0:O.x=0,n&&s.includes("limit")&&(E.set(this.__world).addPoint(this.zoomLayer),t.DragBoundsHelper.getValidMove(E,this.canvas.bounds,"auto",O,!0),s.includes("x")?O.y=0:s.includes("y")&&(O.x=0))),{x:i?0:O.x,y:i?0:O.y}},M.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:o,max:a,disabled:n}=this.app.config.zoom,i=Math.abs(e*t);return o&&i<o?t=o/e:a&&i>a&&(t=a/e),n?1:t};const x=t.InteractionBase.prototype;x.createTransformer=function(){this.transformer=new D(this)},x.move=function(t){this.transformer.move(t)},x.zoom=function(t){this.transformer.zoom(t)},x.rotate=function(t){this.transformer.rotate(t)},x.transformEnd=function(){this.transformer.transformEnd()},x.wheel=function(e){const{wheel:o,pointer:a}=this.config,{posDeltaSpeed:n,negDeltaSpeed:i}=o;if(o.disabled)return;e.deltaX>0?n&&(e.deltaX*=n):i&&(e.deltaX*=i),e.deltaY>0?n&&(e.deltaY*=n):i&&(e.deltaY*=i);const s=o.getScale?o.getScale(e,o):g.getScale(e,o);if(1!==s)this.zoom(T(s,e));else{const n=o.getMove?o.getMove(e,o):g.getMove(e,o);a.snap&&t.PointHelper.round(n),this.move(b(n,e))}},x.multiTouch=function(e,o){const{disabled:a,singleGesture:n}=this.config.multiTouch;if(a)return;this.pointerWaitCancel();let i=c.getData(o),{moving:s,zooming:r,rotating:m}=this.transformer;if(n){if(!this.transformer.transforming){switch(c.detect(i,t.isObject(n)?n:{})){case"move":s=!0;break;case"zoom":r=!0;break;case"rotate":m=!0;break;default:return}c.reset()}s||(i.center=c.state.center)}else s=r=m=!0;var l,h;Object.assign(e,i.center),e.multiTouch=!0,m&&this.rotate((l=i.rotation,h=e,Object.assign(Object.assign({},h),{rotation:l}))),r&&this.zoom(T(i.scale,e)),s&&this.move(b(i.move,e))};const z=t.Dragger.prototype,{abs:R,min:j,max:H,hypot:P}=Math;z.checkDragEndAnimate=function(e){const{interaction:o}=this,a=this.canAnimate&&this.moving&&o.m.dragAnimate;if(a){const n=t.isNumber(a)?a:.95,i=.15,s=150;let r,c,m,l=0,h=0,u=0,v=0,g=3;const{dragDataList:d}=this,p=d.length;for(let t=p-1;t>=H(p-3,0)&&(m=d[t],!(m.time&&Date.now()-m.time>100));t--)r=g--,l+=m.moveX*r,h+=m.moveY*r,v+=r,c=P(m.moveX,m.moveY),c>u&&(u=c);if(v&&(l/=v,h/=v),u>8){const t=1.15+j((u-8)/17,1)*(1.6-1.15);l*=t,h*=t}const f=H(R(l),R(h));f>s&&(c=s/f,l*=c,h*=c);const y=()=>{if(l*=n,h*=n,e=Object.assign({},e),R(l)<i&&R(h)<i)return this.dragEndReal(e);t.PointHelper.move(e,l,h),this.drag(e),this.animate(y),o.emit(t.MoveEvent.DRAG_ANIMATE,e)};this.animate(y)}return a},z.animate=function(t,e){const o=t||this.animateWait;o&&this.interaction.target.nextRender(o,null,e),this.animateWait=t},z.stopAnimate=function(){this.animate(null,"off"),this.interaction.target.nextRender(()=>{this.dragData&&this.dragEndReal(this.dragData)})},z.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},z.autoMoveOnDragOut=function(e){const{interaction:o,downData:a,canDragOut:n}=this,{autoDistance:i,dragOut:s}=o.m;if(!s||!n||!i)return;const r=o.shrinkCanvasBounds,{x:c,y:m}=r,l=t.BoundsHelper.maxX(r),h=t.BoundsHelper.maxY(r),u=e.x<c?i:l<e.x?-i:0,v=e.y<m?i:h<e.y?-i:0;let g=0,d=0;this.autoMoveTimer=setInterval(()=>{g+=u,d+=v,t.PointHelper.move(a,u,v),t.PointHelper.move(this.dragData,u,v),o.move(Object.assign(Object.assign({},e),{moveX:u,moveY:v,totalX:g,totalY:d,moveType:"drag"})),o.pointerMoveReal(e)},10)},z.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},t.Plugin.add("viewport"),exports.LeaferTypeCreator=i,exports.MultiTouchHelper=c,exports.Transformer=D,exports.WheelEventHelper=g,exports.addViewport=o,exports.addViewportConfig=a;
|
|
2
2
|
//# sourceMappingURL=viewport.min.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.min.cjs","sources":["../../../../../../src/in/packages/viewport/src/type/viewport.ts","../../../../../../src/in/packages/viewport/src/LeaferTypeCreator.ts","../../../../../../src/in/packages/viewport/src/type/custom.ts","../../../../../../src/in/packages/viewport/src/type/design.ts","../../../../../../src/in/packages/viewport/src/type/document.ts","../../../../../../src/in/packages/viewport/src/interaction/MultiTouchHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/WheelEventHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/Transformer.ts","../../../../../../src/in/packages/viewport/src/Leafer.ts","../../../../../../src/in/packages/viewport/src/interaction/Interaction.ts","../../../../../../src/in/packages/viewport/src/interaction/Dragger.ts","../../../../../../src/in/packages/viewport/src/index.ts"],"sourcesContent":["import { ILeaferBase, ILeaferConfig } from '@leafer-ui/interface'\n\nimport { MoveEvent, ZoomEvent, DataHelper, LeafHelper } from '@leafer-ui/core'\n\n\nexport function addViewport(leafer: ILeaferBase, mergeConfig?: ILeaferConfig, custom?: boolean): void {\n addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig)\n if (leafer.isApp || custom) return\n\n leafer.__eventIds.push(\n leafer.on_(MoveEvent.BEFORE_MOVE, (e: MoveEvent) => {\n const move = leafer.getValidMove(e.moveX, e.moveY, false)\n leafer.zoomLayer.move(move)\n }),\n leafer.on_(MoveEvent.DRAG_ANIMATE, () => {\n const move = leafer.getValidMove(0, 0)\n if (move.x || move.y) leafer.interaction.stopDragAnimate()\n }),\n leafer.on_(MoveEvent.END, (e: MoveEvent) => {\n LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY))\n }),\n leafer.on_(ZoomEvent.BEFORE_ZOOM, (e: ZoomEvent) => {\n const { zoomLayer } = leafer\n const changeScale = leafer.getValidScale(e.scale)\n if (changeScale !== 1) zoomLayer.scaleOfWorld(e, changeScale)\n })\n )\n}\n\nexport function addViewportConfig(leafer: ILeaferBase, mergeConfig?: ILeaferConfig): void {\n const viewportConfig: ILeaferConfig = {\n wheel: { preventDefault: true },\n touch: { preventDefault: true },\n pointer: { preventDefaultMenu: true }\n }\n if (mergeConfig) DataHelper.assign(viewportConfig, mergeConfig)\n DataHelper.assign(leafer.config, viewportConfig, leafer.userConfig)\n}","import { ILeaferBase, ILeaferTypeList, ILeaferTypeFunction } from '@leafer-ui/interface'\n\nimport { Debug } from '@leafer-ui/core'\n\nimport { addViewport } from './type/viewport'\nimport { custom } from './type/custom'\nimport { design } from './type/design'\nimport { document } from './type/document'\n\n\nconst debug = Debug.get('LeaferTypeCreator')\n\nexport const LeaferTypeCreator = {\n\n list: {} as ILeaferTypeList,\n\n register(name: string, fn: ILeaferTypeFunction): void {\n list[name] && debug.repeat(name)\n list[name] = fn\n },\n\n run(name: string, leafer: ILeaferBase): void {\n const fn = list[name]\n fn && fn(leafer)\n }\n\n}\n\nconst { list, register } = LeaferTypeCreator\n\nregister('viewport', addViewport)\nregister('custom', custom)\nregister('design', design)\nregister('document', document)","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function custom(leafer: ILeaferBase): void {\n addViewport(leafer, null, true)\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function design(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: {\n min: 0.01,\n max: 256\n },\n move: {\n holdSpaceKey: true,\n holdMiddleKey: true,\n }\n })\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function document(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: { min: 1 },\n move: { scroll: 'limit' }\n })\n}\n","import { IMultiTouchData, IKeepTouchData, IGestureType, IPointData, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { PointHelper } from '@leafer-ui/core'\n\n\nexport const MultiTouchHelper = {\n\n state: { // 单一手势识别状态\n type: 'none' as IGestureType,\n typeCount: 0,\n startTime: 0,\n totalData: null as IMultiTouchData,\n center: {} as IPointData\n },\n\n getData(list: IKeepTouchData[]): IMultiTouchData {\n const a = list[0], b = list[1]\n const lastCenter = PointHelper.getCenter(a.from, b.from)\n const center = PointHelper.getCenter(a.to, b.to)\n const move = { x: center.x - lastCenter.x, y: center.y - lastCenter.y }\n\n const lastDistance = PointHelper.getDistance(a.from, b.from)\n const distance = PointHelper.getDistance(a.to, b.to)\n const scale = distance / lastDistance\n\n const rotation = PointHelper.getRotation(a.from, b.from, a.to, b.to)\n return { move, scale, rotation, center }\n },\n\n getType(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const moveScore = Math.hypot(data.move.x, data.move.y) / (config.move || 5)\n const scaleScore = Math.abs(data.scale - 1) / (config.scale || 0.03)\n const rotateScore = Math.abs(data.rotation) / (config.rotation || 2)\n\n if (moveScore < 1 && scaleScore < 1 && rotateScore < 1) return 'none'\n if (moveScore >= scaleScore && moveScore >= rotateScore) return 'move'\n if (scaleScore >= rotateScore) return 'zoom'\n return 'rotate'\n },\n\n // 识别单一手势\n detect(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const { state } = M\n const type = M.getType(data, config)\n\n if (!state.totalData) {\n state.startTime = Date.now()\n state.center = data.center\n }\n\n M.add(data, state.totalData)\n state.totalData = data\n\n if (type === state.type) { // 连续多帧一样的类型才进行锁定\n state.typeCount++\n if (state.typeCount >= (config.count || 3) && type !== 'none') return type\n } else {\n state.type = type\n state.typeCount = 1\n }\n\n if ((Date.now() - state.startTime) >= (config.time || 160)) return M.getType(state.totalData, config) // 限制最长识别时间\n\n return 'none'\n },\n\n add(data: IMultiTouchData, add: IMultiTouchData): void {\n if (!add) return\n PointHelper.move(data.move, add.move)\n data.scale *= add.scale\n data.rotation += add.rotation\n data.center = add.center\n },\n\n reset() {\n const { state } = M\n state.type = 'none'\n state.typeCount = 0\n state.startTime = 0\n state.totalData = null\n }\n\n}\n\nconst M = MultiTouchHelper","import { IPointData, IWheelEvent, IWheelConfig } from '@leafer-ui/interface'\n\nimport { MathHelper, Platform } from '@leafer-ui/core'\n\n\nconst { abs, max } = Math, { sign, within } = MathHelper\n\nexport const WheelEventHelper = {\n\n getMove(event: IWheelEvent, config: IWheelConfig): IPointData {\n let { moveSpeed } = config\n let { deltaX, deltaY } = event\n if (event.shiftKey && !deltaX) { // Window\n deltaX = deltaY\n deltaY = 0\n }\n const absX = abs(deltaX), absY = abs(deltaY)\n if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX)\n if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY)\n return { x: -deltaX * moveSpeed * 2, y: -deltaY * moveSpeed * 2 }\n },\n\n getScale(event: IWheelEvent, config: IWheelConfig): number {\n\n let zoom: boolean\n let scale = 1\n let { zoomMode, zoomSpeed } = config\n\n const delta = event.deltaY || event.deltaX\n\n if (zoomMode) {\n // mac 触摸板滚动手势的deltaY是整数, 鼠标滚动/触摸板缩放的deltaY有小数点, firfox鼠标滚动为整数,为18或19的倍数\n // windows 始终是整数\n zoom = (zoomMode === 'mouse') ? true : (!event.deltaX && (Platform.intWheelDeltaY ? Math.abs(delta) > 17 : Math.ceil(delta) !== delta))\n if (event.shiftKey || event.metaKey || event.ctrlKey) zoom = true\n } else {\n zoom = !event.shiftKey && (event.metaKey || event.ctrlKey)\n }\n\n if (zoom) {\n zoomSpeed = within(zoomSpeed, 0, 1)\n const min = event.deltaY ? config.delta.y : config.delta.x\n const absScale = within(1 - abs(delta) / (min * 4) * zoomSpeed, 0.5, 2)\n scale = delta > 0 ? absScale : 1 / absScale // 让 scale 放大、缩小可以定位在有规律的刻度上\n }\n\n return scale\n }\n\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, ITimer } from '@leafer-ui/interface'\n\nimport { InteractionBase, MoveEvent, ZoomEvent, RotateEvent } from '@leafer-ui/core'\n\n\nlet totalX: number, totalY: number, totalScale: number, totalRotation: number\n\nexport class Transformer {\n\n public get transforming(): boolean { return this.moving || this.zooming || this.rotating }\n public get moving(): boolean { return !!this.moveData }\n public get zooming(): boolean { return !!this.zoomData }\n public get rotating(): boolean { return !!this.rotateData }\n\n public moveData: IMoveEvent\n public zoomData: IZoomEvent\n public rotateData: IRotateEvent\n\n protected interaction: InteractionBase\n protected transformTimer: ITimer\n\n constructor(interaction: InteractionBase) {\n this.interaction = interaction\n }\n\n public move(data: IMoveEvent): void {\n const { interaction } = this\n if (!data.moveType) data.moveType = 'move'\n\n if (!this.moveData) {\n this.setPath(data)\n totalX = 0, totalY = 0\n this.moveData = { ...data, moveX: 0, moveY: 0, totalX, totalY }\n interaction.emit(MoveEvent.START, this.moveData)\n }\n\n data.path = this.moveData.path\n data.totalX = totalX = totalX + data.moveX\n data.totalY = totalY = totalY + data.moveY\n interaction.emit(MoveEvent.BEFORE_MOVE, data)\n interaction.emit(MoveEvent.MOVE, data)\n\n this.transformEndWait()\n }\n\n public zoom(data: IZoomEvent): void {\n const { interaction } = this\n\n if (!this.zoomData) {\n this.setPath(data)\n totalScale = 1\n this.zoomData = { ...data, scale: 1, totalScale }\n interaction.emit(ZoomEvent.START, this.zoomData)\n }\n\n data.path = this.zoomData.path\n data.totalScale = totalScale = totalScale * data.scale\n interaction.emit(ZoomEvent.BEFORE_ZOOM, data)\n interaction.emit(ZoomEvent.ZOOM, data)\n\n this.transformEndWait()\n }\n\n public rotate(data: IRotateEvent): void {\n const { interaction } = this\n\n if (!this.rotateData) {\n this.setPath(data)\n totalRotation = 0\n this.rotateData = { ...data, rotation: 0, totalRotation }\n interaction.emit(RotateEvent.START, this.rotateData)\n }\n\n data.path = this.rotateData.path\n data.totalRotation = totalRotation = totalRotation + data.rotation\n interaction.emit(RotateEvent.BEFORE_ROTATE, data)\n interaction.emit(RotateEvent.ROTATE, data)\n\n this.transformEndWait()\n }\n\n public setPath(data: any): void {\n const { interaction } = this\n const { path } = interaction.selector.getByPoint(data, interaction.hitRadius)\n data.path = path\n interaction.cancelHover()\n }\n\n protected transformEndWait(): void {\n clearTimeout(this.transformTimer)\n this.transformTimer = setTimeout(() => {\n this.transformEnd()\n }, this.interaction.p.transformTime)\n }\n\n public transformEnd(): void {\n const { interaction, moveData, zoomData, rotateData } = this\n if (moveData) interaction.emit(MoveEvent.END, { ...moveData, totalX, totalY } as IMoveEvent)\n if (zoomData) interaction.emit(ZoomEvent.END, { ...zoomData, totalScale } as IZoomEvent)\n if (rotateData) interaction.emit(RotateEvent.END, { ...rotateData, totalRotation } as IRotateEvent)\n this.reset()\n }\n\n public reset(): void {\n this.zoomData = this.moveData = this.rotateData = null\n }\n\n public destroy(): void {\n this.reset()\n }\n}","import { ILeaferType, IPointData } from '@leafer-ui/interface'\n\nimport { Leafer, Bounds, Point, DragBoundsHelper } from '@leafer-ui/core'\n\nimport { LeaferTypeCreator } from './LeaferTypeCreator'\n\n\nconst leafer = Leafer.prototype\nconst bounds = new Bounds(), move = new Point()\n\nleafer.initType = function (type: ILeaferType) {\n LeaferTypeCreator.run(type, this)\n}\n\nleafer.getValidMove = function (moveX: number, moveY: number, checkLimit = true): IPointData {\n const { scroll, disabled } = this.app.config.move\n move.set(moveX, moveY)\n\n if (scroll) {\n const type = scroll === true ? '' : scroll\n\n if (type.includes('x')) move.y = 0\n else if (type.includes('y')) move.x = 0\n else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0\n\n if (checkLimit && type.includes('limit')) {\n bounds.set(this.__world).addPoint(this.zoomLayer as IPointData)\n DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, 'auto', move, true)\n if (type.includes('x')) move.y = 0\n else if (type.includes('y')) move.x = 0\n }\n }\n\n return { x: disabled ? 0 : move.x, y: disabled ? 0 : move.y }\n}\n\nleafer.getValidScale = function (changeScale: number): number {\n const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale)\n if (min && absScale < min) changeScale = min / scaleX\n else if (max && absScale > max) changeScale = max / scaleX\n return disabled ? 1 : changeScale // fix 不能过滤小数位\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, IKeepTouchData, IPointData, IEvent, IPointerEvent, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { InteractionBase, PointHelper, isObject } from '@leafer-ui/core'\n\nimport { WheelEventHelper } from './WheelEventHelper'\nimport { Transformer } from './Transformer'\nimport { MultiTouchHelper } from './MultiTouchHelper'\n\n\nfunction getMoveEventData(move: IPointData, event: IEvent): IMoveEvent {\n return { ...event, moveX: move.x, moveY: move.y } as IMoveEvent\n}\n\nfunction getRotateEventData(rotation: number, event: IEvent): IRotateEvent {\n return { ...event, rotation } as IRotateEvent\n}\n\nfunction getZoomEventData(scale: number, event: IEvent): IZoomEvent {\n return { ...event, scale, } as IZoomEvent\n}\n\n\nconst interaction = InteractionBase.prototype\n\ninteraction.createTransformer = function (): void {\n this.transformer = new Transformer(this)\n}\n\ninteraction.move = function (data: IMoveEvent): void {\n this.transformer.move(data)\n}\n\ninteraction.zoom = function (data: IZoomEvent): void {\n this.transformer.zoom(data)\n}\n\ninteraction.rotate = function (data: IRotateEvent): void {\n this.transformer.rotate(data)\n}\n\ninteraction.transformEnd = function (): void {\n this.transformer.transformEnd()\n}\n\n\ninteraction.wheel = function (data: IWheelEvent): void {\n const { wheel, pointer } = this.config, { posDeltaSpeed, negDeltaSpeed } = wheel\n if (wheel.disabled) return\n\n if (data.deltaX > 0) posDeltaSpeed && (data.deltaX *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaX *= negDeltaSpeed)\n\n if (data.deltaY > 0) posDeltaSpeed && (data.deltaY *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaY *= negDeltaSpeed)\n\n const scale = wheel.getScale ? wheel.getScale(data, wheel) : WheelEventHelper.getScale(data, wheel)\n if (scale !== 1) this.zoom(getZoomEventData(scale, data))\n else {\n const move = wheel.getMove ? wheel.getMove(data, wheel) : WheelEventHelper.getMove(data, wheel)\n if (pointer.snap) PointHelper.round(move)\n this.move(getMoveEventData(move, data))\n }\n}\n\n\ninteraction.multiTouch = function (data: IPointerEvent, list: IKeepTouchData[]): void {\n const { disabled, singleGesture } = this.config.multiTouch\n if (disabled) return\n this.pointerWaitCancel()\n\n let gestureData = MultiTouchHelper.getData(list)\n let { moving, zooming, rotating } = this.transformer\n\n if (singleGesture) {\n\n if (!this.transformer.transforming) {\n\n const type = MultiTouchHelper.detect(gestureData, isObject(singleGesture) ? singleGesture : {} as ISingleGestureConfig)\n\n switch (type) {\n case 'move': moving = true; break\n case 'zoom': zooming = true; break\n case 'rotate': rotating = true; break\n default: return\n }\n\n MultiTouchHelper.reset()\n\n }\n\n if (!moving) gestureData.center = MultiTouchHelper.state.center\n\n } else moving = zooming = rotating = true\n\n Object.assign(data, gestureData.center)\n data.multiTouch = true\n\n if (rotating) this.rotate(getRotateEventData(gestureData.rotation, data))\n if (zooming) this.zoom(getZoomEventData(gestureData.scale, data))\n if (moving) this.move(getMoveEventData(gestureData.move, data))\n}","import { IPointerEvent, IFunction, IDragEvent } from '@leafer-ui/interface'\n\nimport { Dragger, BoundsHelper, PointHelper, MoveEvent, isNumber } from '@leafer-ui/core'\n\n\nconst dragger = Dragger.prototype\nconst { abs, min, max, hypot } = Math\n\ndragger.checkDragEndAnimate = function (data: IPointerEvent): boolean | number {\n const { interaction } = this\n const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate\n\n if (dragAnimate) {\n\n const inertia = isNumber(dragAnimate) ? dragAnimate : 0.95\n const stopMove = 0.15\n const maxMove = 150\n\n let moveX = 0, moveY = 0, flickSpeed = 0 // 快速滑动加速\n let totalWeight = 0, weight: number, w = 3, s: number, frame: IDragEvent\n\n const { dragDataList } = this, len = dragDataList.length\n for (let i = len - 1; i >= max(len - 3, 0); i--) {\n frame = dragDataList[i]\n if (frame.time && (Date.now() - frame.time > 100)) break\n weight = w--\n\n moveX += frame.moveX * weight\n moveY += frame.moveY * weight\n totalWeight += weight\n\n s = hypot(frame.moveX, frame.moveY)\n if (s > flickSpeed) flickSpeed = s\n }\n\n if (totalWeight) moveX /= totalWeight, moveY /= totalWeight\n\n if (flickSpeed > 8) {\n const t = min((flickSpeed - 8) / 17, 1)\n const boost = 1.15 + t * (1.6 - 1.15)\n moveX *= boost\n moveY *= boost\n }\n\n const maxAbs = max(abs(moveX), abs(moveY))\n if (maxAbs > maxMove) {\n s = maxMove / maxAbs\n moveX *= s\n moveY *= s\n }\n\n const step = () => {\n moveX *= inertia\n moveY *= inertia\n\n data = { ...data }\n if (abs(moveX) < stopMove && abs(moveY) < stopMove) return this.dragEndReal(data)\n\n PointHelper.move(data, moveX, moveY)\n this.drag(data)\n\n this.animate(step)\n interaction.emit(MoveEvent.DRAG_ANIMATE, data)\n }\n\n this.animate(step)\n }\n\n return dragAnimate\n}\n\ndragger.animate = function (func?: IFunction, off?: 'off'): void { // dragEnd animation\n const animateWait = func || this.animateWait\n if (animateWait) this.interaction.target.nextRender(animateWait, null, off)\n this.animateWait = func\n}\n\ndragger.stopAnimate = function (): void {\n this.animate(null, 'off')\n this.interaction.target.nextRender(() => {\n if (this.dragData) this.dragEndReal(this.dragData)\n })\n}\n\ndragger.checkDragOut = function (data: IPointerEvent): void {\n const { interaction } = this\n this.autoMoveCancel()\n if (this.dragging && !interaction.shrinkCanvasBounds.hitPoint(data)) this.autoMoveOnDragOut(data)\n}\n\ndragger.autoMoveOnDragOut = function (data: IPointerEvent): void {\n const { interaction, downData, canDragOut } = this\n const { autoDistance, dragOut } = interaction.m\n if (!dragOut || !canDragOut || !autoDistance) return\n\n const bounds = interaction.shrinkCanvasBounds\n const { x, y } = bounds\n const right = BoundsHelper.maxX(bounds)\n const bottom = BoundsHelper.maxY(bounds)\n\n const moveX = data.x < x ? autoDistance : (right < data.x ? -autoDistance : 0)\n const moveY = data.y < y ? autoDistance : (bottom < data.y ? -autoDistance : 0)\n let totalX = 0, totalY = 0\n\n this.autoMoveTimer = setInterval(() => {\n totalX += moveX\n totalY += moveY\n\n PointHelper.move(downData, moveX, moveY)\n PointHelper.move(this.dragData, moveX, moveY)\n\n interaction.move({ ...data, moveX, moveY, totalX, totalY, moveType: 'drag' })\n interaction.pointerMoveReal(data)\n }, 10)\n}\n\ndragger.autoMoveCancel = function (): void {\n if (this.autoMoveTimer) {\n clearInterval(this.autoMoveTimer)\n this.autoMoveTimer = 0\n }\n}","export { LeaferTypeCreator } from './LeaferTypeCreator'\nexport { addViewport, addViewportConfig } from './type/viewport'\nexport { MultiTouchHelper } from './interaction/MultiTouchHelper'\nexport { WheelEventHelper } from './interaction/WheelEventHelper'\nexport { Transformer } from './interaction/Transformer'\n\nimport { Plugin } from '@leafer-ui/core'\n\nimport './Leafer'\nimport './interaction/Interaction'\nimport './interaction/Dragger'\n\nPlugin.add('viewport')"],"names":["addViewport","leafer","mergeConfig","custom","addViewportConfig","parentApp","isApp","__eventIds","push","on_","MoveEvent","BEFORE_MOVE","e","move","getValidMove","moveX","moveY","zoomLayer","DRAG_ANIMATE","x","y","interaction","stopDragAnimate","END","LeafHelper","animateMove","ZoomEvent","BEFORE_ZOOM","changeScale","getValidScale","scale","scaleOfWorld","viewportConfig","wheel","preventDefault","touch","pointer","preventDefaultMenu","DataHelper","assign","config","userConfig","debug","Debug","get","LeaferTypeCreator","list","register","name","fn","repeat","run","zoom","min","max","holdSpaceKey","holdMiddleKey","scroll","MultiTouchHelper","state","type","typeCount","startTime","totalData","center","getData","a","b","lastCenter","PointHelper","getCenter","from","to","lastDistance","getDistance","rotation","getRotation","getType","data","moveScore","Math","hypot","scaleScore","abs","rotateScore","detect","M","Date","now","add","count","time","reset","sign","within","MathHelper","WheelEventHelper","getMove","event","moveSpeed","deltaX","deltaY","shiftKey","absX","absY","getScale","zoomMode","zoomSpeed","delta","Platform","intWheelDeltaY","ceil","metaKey","ctrlKey","absScale","totalX","totalY","totalScale","totalRotation","Transformer","transforming","this","moving","zooming","rotating","moveData","zoomData","rotateData","constructor","moveType","setPath","Object","emit","START","path","MOVE","transformEndWait","ZOOM","rotate","RotateEvent","BEFORE_ROTATE","ROTATE","selector","getByPoint","hitRadius","cancelHover","clearTimeout","transformTimer","setTimeout","transformEnd","p","transformTime","destroy","Leafer","prototype","bounds","Bounds","Point","getMoveEventData","getZoomEventData","initType","checkLimit","disabled","app","set","includes","__world","addPoint","DragBoundsHelper","canvas","scaleX","__","InteractionBase","createTransformer","transformer","posDeltaSpeed","negDeltaSpeed","snap","round","multiTouch","singleGesture","pointerWaitCancel","gestureData","isObject","dragger","Dragger","checkDragEndAnimate","dragAnimate","canAnimate","m","inertia","isNumber","stopMove","maxMove","weight","s","frame","flickSpeed","totalWeight","w","dragDataList","len","length","i","boost","maxAbs","step","dragEndReal","drag","animate","func","off","animateWait","target","nextRender","stopAnimate","dragData","checkDragOut","autoMoveCancel","dragging","shrinkCanvasBounds","hitPoint","autoMoveOnDragOut","downData","canDragOut","autoDistance","dragOut","right","BoundsHelper","maxX","bottom","maxY","autoMoveTimer","setInterval","pointerMoveReal","clearInterval","Plugin"],"mappings":"uDAKgBA,EAAYC,EAAqBC,EAA6BC,GAC1EC,EAAkBH,EAAOI,UAAYJ,EAAOI,UAAYJ,EAAQC,GAC5DD,EAAOK,OAASH,GAEpBF,EAAOM,WAAWC,KACdP,EAAOQ,IAAIC,YAAUC,YAAcC,IAC/B,MAAMC,EAAOZ,EAAOa,aAAaF,EAAEG,MAAOH,EAAEI,OAAO,GACnDf,EAAOgB,UAAUJ,KAAKA,KAE1BZ,EAAOQ,IAAIC,EAAAA,UAAUQ,aAAc,KAC/B,MAAML,EAAOZ,EAAOa,aAAa,EAAG,IAChCD,EAAKM,GAAKN,EAAKO,IAAGnB,EAAOoB,YAAYC,oBAE7CrB,EAAOQ,IAAIC,EAAAA,UAAUa,IAAMX,IACvBY,EAAAA,WAAWC,YAAYxB,EAAOgB,UAAWhB,EAAOa,aAAaF,EAAEG,M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AYwK,EAC9C,IAAKqC,IAAYF,IAAeC,EAAc,OAE9C,MAAMtE,EAAStI,EAAYuM,oBACrBzM,EAAEA,EAACC,EAAEA,GAAMuI,EACXwE,EAAQC,EAAAA,aAAaC,KAAK1E,GAC1B2E,EAASF,EAAAA,aAAaG,KAAK5E,GAE3B5I,EAAQ+D,EAAK3D,EAAIA,EAAI8M,EAAgBE,EAAQrJ,EAAK3D,GAAK8M,EAAe,EACtEjN,EAAQ8D,EAAK1D,EAAIA,EAAI6M,EAAgBK,EAASxJ,EAAK1D,GAAK6M,EAAe,EAC7E,IAAI9G,EAAS,EAAGC,EAAS,EAEzBK,KAAK+G,cAAgBC,YAAY,KAC7BtH,GAAUpG,EACVqG,GAAUpG,EAEVqD,EAAAA,YAAYxD,KAAKkN,EAAUhN,EAAOC,GAClCqD,EAAAA,YAAYxD,KAAK4G,KAAK+F,SAAUzM,EAAOC,GAEvCK,EAAYR,KAAIsH,OAAA5F,OAAA4F,OAAA5F,OAAA,GAAMuC,GAAI,CAAE/D,QAAOC,QAAOmG,SAAQC,SAAQa,SAAU,UACpE5G,EAAYqN,gBAAgB5J,IAC7B,GACP,EAEA0G,EAAQkC,eAAiB,WACjBjG,KAAK+G,gBACLG,cAAclH,KAAK+G,eACnB/G,KAAK+G,cAAgB,EAE7B,EC7GAI,EAAAA,OAAOnJ,IAAI"}
|
|
1
|
+
{"version":3,"file":"viewport.min.cjs","sources":["../../../../../../src/in/packages/viewport/src/helper.ts","../../../../../../src/in/packages/viewport/src/type/viewport.ts","../../../../../../src/in/packages/viewport/src/LeaferTypeCreator.ts","../../../../../../src/in/packages/viewport/src/type/custom.ts","../../../../../../src/in/packages/viewport/src/type/design.ts","../../../../../../src/in/packages/viewport/src/type/document.ts","../../../../../../src/in/packages/viewport/src/interaction/MultiTouchHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/WheelEventHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/Transformer.ts","../../../../../../src/in/packages/viewport/src/Leafer.ts","../../../../../../src/in/packages/viewport/src/interaction/Interaction.ts","../../../../../../src/in/packages/viewport/src/interaction/Dragger.ts","../../../../../../src/in/packages/viewport/src/index.ts"],"sourcesContent":["import { ILeaferBase } from '@leafer-ui/interface'\n\n\nexport function getScrollType(leafer: ILeaferBase): string {\n const { scroll, disabled } = leafer.app.config.move\n return (!scroll || disabled) ? '' : (scroll === true ? 'free' : scroll)\n}","import { ILeaferBase, ILeaferConfig } from '@leafer-ui/interface'\n\nimport { MoveEvent, ZoomEvent, DataHelper, LeafHelper } from '@leafer-ui/core'\n\nimport { getScrollType } from '../helper'\n\n\nexport function addViewport(leafer: ILeaferBase, mergeConfig?: ILeaferConfig, custom?: boolean): void {\n addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig)\n if (leafer.isApp || custom) return\n\n leafer.__eventIds.push(\n leafer.on_(MoveEvent.BEFORE_MOVE, (e: MoveEvent) => {\n const move = leafer.getValidMove(e.moveX, e.moveY, false)\n\n // check limit\n if (getScrollType(leafer).includes('limit')) {\n const testMove = leafer.getValidMove(0, 0)\n if (testMove.x || testMove.y) {\n const maxX = 100, maxY = 200, resistance = e.moveType === 'drag' ? 0.3 : 0.05\n\n if (Math.abs(testMove.x) > maxX) move.x = 0\n else move.x *= resistance\n\n if (Math.abs(testMove.y) > maxY) move.y = 0\n else move.y *= resistance\n }\n }\n\n leafer.zoomLayer.move(move)\n }),\n leafer.on_(MoveEvent.DRAG_ANIMATE, () => {\n const testMove = leafer.getValidMove(0, 0)\n if (testMove.x || testMove.y) leafer.interaction.stopDragAnimate()\n }),\n leafer.on_(MoveEvent.END, (e: MoveEvent) => {\n LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY))\n }),\n leafer.on_(ZoomEvent.BEFORE_ZOOM, (e: ZoomEvent) => {\n const { zoomLayer } = leafer\n const changeScale = leafer.getValidScale(e.scale)\n if (changeScale !== 1) zoomLayer.scaleOfWorld(e, changeScale)\n })\n )\n}\n\nexport function addViewportConfig(leafer: ILeaferBase, mergeConfig?: ILeaferConfig): void {\n const viewportConfig: ILeaferConfig = {\n wheel: { preventDefault: true },\n touch: { preventDefault: true },\n pointer: { preventDefaultMenu: true }\n }\n if (mergeConfig) DataHelper.assign(viewportConfig, mergeConfig)\n DataHelper.assign(leafer.config, viewportConfig, leafer.userConfig)\n}","import { ILeaferBase, ILeaferTypeList, ILeaferTypeFunction } from '@leafer-ui/interface'\n\nimport { Debug } from '@leafer-ui/core'\n\nimport { addViewport } from './type/viewport'\nimport { custom } from './type/custom'\nimport { design } from './type/design'\nimport { document } from './type/document'\n\n\nconst debug = Debug.get('LeaferTypeCreator')\n\nexport const LeaferTypeCreator = {\n\n list: {} as ILeaferTypeList,\n\n register(name: string, fn: ILeaferTypeFunction): void {\n list[name] && debug.repeat(name)\n list[name] = fn\n },\n\n run(name: string, leafer: ILeaferBase): void {\n const fn = list[name]\n fn && fn(leafer)\n }\n\n}\n\nconst { list, register } = LeaferTypeCreator\n\nregister('viewport', addViewport)\nregister('custom', custom)\nregister('design', design)\nregister('document', document)","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function custom(leafer: ILeaferBase): void {\n addViewport(leafer, null, true)\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function design(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: {\n min: 0.01,\n max: 256\n },\n move: {\n holdSpaceKey: true,\n holdMiddleKey: true,\n }\n })\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function document(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: { min: 1 },\n move: { scroll: 'limit' }\n })\n}\n","import { IMultiTouchData, IKeepTouchData, IGestureType, IPointData, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { PointHelper } from '@leafer-ui/core'\n\n\nexport const MultiTouchHelper = {\n\n state: { // 单一手势识别状态\n type: 'none' as IGestureType,\n typeCount: 0,\n startTime: 0,\n totalData: null as IMultiTouchData,\n center: {} as IPointData\n },\n\n getData(list: IKeepTouchData[]): IMultiTouchData {\n const a = list[0], b = list[1]\n const lastCenter = PointHelper.getCenter(a.from, b.from)\n const center = PointHelper.getCenter(a.to, b.to)\n const move = { x: center.x - lastCenter.x, y: center.y - lastCenter.y }\n\n const lastDistance = PointHelper.getDistance(a.from, b.from)\n const distance = PointHelper.getDistance(a.to, b.to)\n const scale = distance / lastDistance\n\n const rotation = PointHelper.getRotation(a.from, b.from, a.to, b.to)\n return { move, scale, rotation, center }\n },\n\n getType(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const moveScore = Math.hypot(data.move.x, data.move.y) / (config.move || 5)\n const scaleScore = Math.abs(data.scale - 1) / (config.scale || 0.03)\n const rotateScore = Math.abs(data.rotation) / (config.rotation || 2)\n\n if (moveScore < 1 && scaleScore < 1 && rotateScore < 1) return 'none'\n if (moveScore >= scaleScore && moveScore >= rotateScore) return 'move'\n if (scaleScore >= rotateScore) return 'zoom'\n return 'rotate'\n },\n\n // 识别单一手势\n detect(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const { state } = M\n const type = M.getType(data, config)\n\n if (!state.totalData) {\n state.startTime = Date.now()\n state.center = data.center\n }\n\n M.add(data, state.totalData)\n state.totalData = data\n\n if (type === state.type) { // 连续多帧一样的类型才进行锁定\n state.typeCount++\n if (state.typeCount >= (config.count || 3) && type !== 'none') return type\n } else {\n state.type = type\n state.typeCount = 1\n }\n\n if ((Date.now() - state.startTime) >= (config.time || 160)) return M.getType(state.totalData, config) // 限制最长识别时间\n\n return 'none'\n },\n\n add(data: IMultiTouchData, add: IMultiTouchData): void {\n if (!add) return\n PointHelper.move(data.move, add.move)\n data.scale *= add.scale\n data.rotation += add.rotation\n data.center = add.center\n },\n\n reset() {\n const { state } = M\n state.type = 'none'\n state.typeCount = 0\n state.startTime = 0\n state.totalData = null\n }\n\n}\n\nconst M = MultiTouchHelper","import { IPointData, IWheelEvent, IWheelConfig } from '@leafer-ui/interface'\n\nimport { MathHelper, Platform } from '@leafer-ui/core'\n\n\nconst { abs, max } = Math, { sign, within } = MathHelper\n\nexport const WheelEventHelper = {\n\n getMove(event: IWheelEvent, config: IWheelConfig): IPointData {\n let { moveSpeed } = config\n let { deltaX, deltaY } = event\n if (event.shiftKey && !deltaX) { // Window\n deltaX = deltaY\n deltaY = 0\n }\n const absX = abs(deltaX), absY = abs(deltaY)\n if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX)\n if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY)\n return { x: -deltaX * moveSpeed * 2, y: -deltaY * moveSpeed * 2 }\n },\n\n getScale(event: IWheelEvent, config: IWheelConfig): number {\n\n let zoom: boolean\n let scale = 1\n let { zoomMode, zoomSpeed } = config\n\n const delta = event.deltaY || event.deltaX\n\n if (zoomMode) {\n // mac 触摸板滚动手势的deltaY是整数, 鼠标滚动/触摸板缩放的deltaY有小数点, firfox鼠标滚动为整数,为18或19的倍数\n // windows 始终是整数\n zoom = (zoomMode === 'mouse') ? true : (!event.deltaX && (Platform.intWheelDeltaY ? Math.abs(delta) > 17 : Math.ceil(delta) !== delta))\n if (event.shiftKey || event.metaKey || event.ctrlKey) zoom = true\n } else {\n zoom = !event.shiftKey && (event.metaKey || event.ctrlKey)\n }\n\n if (zoom) {\n zoomSpeed = within(zoomSpeed, 0, 1)\n const min = event.deltaY ? config.delta.y : config.delta.x\n const absScale = within(1 - abs(delta) / (min * 4) * zoomSpeed, 0.5, 2)\n scale = delta > 0 ? absScale : 1 / absScale // 让 scale 放大、缩小可以定位在有规律的刻度上\n }\n\n return scale\n }\n\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, ITimer } from '@leafer-ui/interface'\n\nimport { InteractionBase, MoveEvent, ZoomEvent, RotateEvent } from '@leafer-ui/core'\n\n\nlet totalX: number, totalY: number, totalScale: number, totalRotation: number\n\nexport class Transformer {\n\n public get transforming(): boolean { return this.moving || this.zooming || this.rotating }\n public get moving(): boolean { return !!this.moveData }\n public get zooming(): boolean { return !!this.zoomData }\n public get rotating(): boolean { return !!this.rotateData }\n\n public moveData: IMoveEvent\n public zoomData: IZoomEvent\n public rotateData: IRotateEvent\n\n protected interaction: InteractionBase\n protected transformTimer: ITimer\n\n constructor(interaction: InteractionBase) {\n this.interaction = interaction\n }\n\n public move(data: IMoveEvent): void {\n const { interaction } = this\n if (!data.moveType) data.moveType = 'move'\n\n if (!this.moveData) {\n this.setPath(data)\n totalX = 0, totalY = 0\n this.moveData = { ...data, moveX: 0, moveY: 0, totalX, totalY }\n interaction.emit(MoveEvent.START, this.moveData)\n }\n\n data.path = this.moveData.path\n data.totalX = totalX = totalX + data.moveX\n data.totalY = totalY = totalY + data.moveY\n interaction.emit(MoveEvent.BEFORE_MOVE, data)\n interaction.emit(MoveEvent.MOVE, data)\n\n this.transformEndWait()\n }\n\n public zoom(data: IZoomEvent): void {\n const { interaction } = this\n\n if (!this.zoomData) {\n this.setPath(data)\n totalScale = 1\n this.zoomData = { ...data, scale: 1, totalScale }\n interaction.emit(ZoomEvent.START, this.zoomData)\n }\n\n data.path = this.zoomData.path\n data.totalScale = totalScale = totalScale * data.scale\n interaction.emit(ZoomEvent.BEFORE_ZOOM, data)\n interaction.emit(ZoomEvent.ZOOM, data)\n\n this.transformEndWait()\n }\n\n public rotate(data: IRotateEvent): void {\n const { interaction } = this\n\n if (!this.rotateData) {\n this.setPath(data)\n totalRotation = 0\n this.rotateData = { ...data, rotation: 0, totalRotation }\n interaction.emit(RotateEvent.START, this.rotateData)\n }\n\n data.path = this.rotateData.path\n data.totalRotation = totalRotation = totalRotation + data.rotation\n interaction.emit(RotateEvent.BEFORE_ROTATE, data)\n interaction.emit(RotateEvent.ROTATE, data)\n\n this.transformEndWait()\n }\n\n public setPath(data: any): void {\n const { interaction } = this\n const { path } = interaction.selector.getByPoint(data, interaction.hitRadius)\n data.path = path\n interaction.cancelHover()\n }\n\n protected transformEndWait(): void {\n clearTimeout(this.transformTimer)\n this.transformTimer = setTimeout(() => {\n this.transformEnd()\n }, this.interaction.p.transformTime)\n }\n\n public transformEnd(): void {\n const { interaction, moveData, zoomData, rotateData } = this\n if (moveData) interaction.emit(MoveEvent.END, { ...moveData, totalX, totalY } as IMoveEvent)\n if (zoomData) interaction.emit(ZoomEvent.END, { ...zoomData, totalScale } as IZoomEvent)\n if (rotateData) interaction.emit(RotateEvent.END, { ...rotateData, totalRotation } as IRotateEvent)\n this.reset()\n }\n\n public reset(): void {\n this.zoomData = this.moveData = this.rotateData = null\n }\n\n public destroy(): void {\n this.reset()\n }\n}","import { ILeaferType, IPointData } from '@leafer-ui/interface'\n\nimport { Leafer, Bounds, Point, DragBoundsHelper } from '@leafer-ui/core'\n\nimport { LeaferTypeCreator } from './LeaferTypeCreator'\nimport { getScrollType } from './helper'\n\n\nconst leafer = Leafer.prototype\nconst bounds = new Bounds(), move = new Point()\n\nleafer.initType = function (type: ILeaferType) {\n LeaferTypeCreator.run(type, this)\n}\n\nleafer.getValidMove = function (moveX: number, moveY: number, checkLimit = true): IPointData {\n const { disabled } = this.app.config.move\n move.set(moveX, moveY)\n\n const scrollType = getScrollType(this)\n if (scrollType) {\n\n if (scrollType.includes('x')) move.y = 0\n else if (scrollType.includes('y')) move.x = 0\n else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0\n\n if (checkLimit && scrollType.includes('limit')) {\n bounds.set(this.__world).addPoint(this.zoomLayer as IPointData)\n DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, 'auto', move, true)\n if (scrollType.includes('x')) move.y = 0\n else if (scrollType.includes('y')) move.x = 0\n }\n }\n\n return { x: disabled ? 0 : move.x, y: disabled ? 0 : move.y }\n}\n\nleafer.getValidScale = function (changeScale: number): number {\n const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale)\n if (min && absScale < min) changeScale = min / scaleX\n else if (max && absScale > max) changeScale = max / scaleX\n return disabled ? 1 : changeScale // fix 不能过滤小数位\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, IKeepTouchData, IPointData, IEvent, IPointerEvent, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { InteractionBase, PointHelper, isObject } from '@leafer-ui/core'\n\nimport { WheelEventHelper } from './WheelEventHelper'\nimport { Transformer } from './Transformer'\nimport { MultiTouchHelper } from './MultiTouchHelper'\n\n\nfunction getMoveEventData(move: IPointData, event: IEvent): IMoveEvent {\n return { ...event, moveX: move.x, moveY: move.y } as IMoveEvent\n}\n\nfunction getRotateEventData(rotation: number, event: IEvent): IRotateEvent {\n return { ...event, rotation } as IRotateEvent\n}\n\nfunction getZoomEventData(scale: number, event: IEvent): IZoomEvent {\n return { ...event, scale, } as IZoomEvent\n}\n\n\nconst interaction = InteractionBase.prototype\n\ninteraction.createTransformer = function (): void {\n this.transformer = new Transformer(this)\n}\n\ninteraction.move = function (data: IMoveEvent): void {\n this.transformer.move(data)\n}\n\ninteraction.zoom = function (data: IZoomEvent): void {\n this.transformer.zoom(data)\n}\n\ninteraction.rotate = function (data: IRotateEvent): void {\n this.transformer.rotate(data)\n}\n\ninteraction.transformEnd = function (): void {\n this.transformer.transformEnd()\n}\n\n\ninteraction.wheel = function (data: IWheelEvent): void {\n const { wheel, pointer } = this.config, { posDeltaSpeed, negDeltaSpeed } = wheel\n if (wheel.disabled) return\n\n if (data.deltaX > 0) posDeltaSpeed && (data.deltaX *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaX *= negDeltaSpeed)\n\n if (data.deltaY > 0) posDeltaSpeed && (data.deltaY *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaY *= negDeltaSpeed)\n\n const scale = wheel.getScale ? wheel.getScale(data, wheel) : WheelEventHelper.getScale(data, wheel)\n if (scale !== 1) this.zoom(getZoomEventData(scale, data))\n else {\n const move = wheel.getMove ? wheel.getMove(data, wheel) : WheelEventHelper.getMove(data, wheel)\n if (pointer.snap) PointHelper.round(move)\n this.move(getMoveEventData(move, data))\n }\n}\n\n\ninteraction.multiTouch = function (data: IPointerEvent, list: IKeepTouchData[]): void {\n const { disabled, singleGesture } = this.config.multiTouch\n if (disabled) return\n this.pointerWaitCancel()\n\n let gestureData = MultiTouchHelper.getData(list)\n let { moving, zooming, rotating } = this.transformer\n\n if (singleGesture) {\n\n if (!this.transformer.transforming) {\n\n const type = MultiTouchHelper.detect(gestureData, isObject(singleGesture) ? singleGesture : {} as ISingleGestureConfig)\n\n switch (type) {\n case 'move': moving = true; break\n case 'zoom': zooming = true; break\n case 'rotate': rotating = true; break\n default: return\n }\n\n MultiTouchHelper.reset()\n\n }\n\n if (!moving) gestureData.center = MultiTouchHelper.state.center\n\n } else moving = zooming = rotating = true\n\n Object.assign(data, gestureData.center)\n data.multiTouch = true\n\n if (rotating) this.rotate(getRotateEventData(gestureData.rotation, data))\n if (zooming) this.zoom(getZoomEventData(gestureData.scale, data))\n if (moving) this.move(getMoveEventData(gestureData.move, data))\n}","import { IPointerEvent, IFunction, IDragEvent } from '@leafer-ui/interface'\n\nimport { Dragger, BoundsHelper, PointHelper, MoveEvent, isNumber } from '@leafer-ui/core'\n\n\nconst dragger = Dragger.prototype\nconst { abs, min, max, hypot } = Math\n\ndragger.checkDragEndAnimate = function (data: IPointerEvent): boolean | number {\n const { interaction } = this\n const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate\n\n if (dragAnimate) {\n\n const inertia = isNumber(dragAnimate) ? dragAnimate : 0.95\n const stopMove = 0.15\n const maxMove = 150\n\n let moveX = 0, moveY = 0, flickSpeed = 0 // 快速滑动加速\n let totalWeight = 0, weight: number, w = 3, s: number, frame: IDragEvent\n\n const { dragDataList } = this, len = dragDataList.length\n for (let i = len - 1; i >= max(len - 3, 0); i--) {\n frame = dragDataList[i]\n if (frame.time && (Date.now() - frame.time > 100)) break\n weight = w--\n\n moveX += frame.moveX * weight\n moveY += frame.moveY * weight\n totalWeight += weight\n\n s = hypot(frame.moveX, frame.moveY)\n if (s > flickSpeed) flickSpeed = s\n }\n\n if (totalWeight) moveX /= totalWeight, moveY /= totalWeight\n\n if (flickSpeed > 8) {\n const t = min((flickSpeed - 8) / 17, 1)\n const boost = 1.15 + t * (1.6 - 1.15)\n moveX *= boost\n moveY *= boost\n }\n\n const maxAbs = max(abs(moveX), abs(moveY))\n if (maxAbs > maxMove) {\n s = maxMove / maxAbs\n moveX *= s\n moveY *= s\n }\n\n const step = () => {\n moveX *= inertia\n moveY *= inertia\n\n data = { ...data }\n if (abs(moveX) < stopMove && abs(moveY) < stopMove) return this.dragEndReal(data)\n\n PointHelper.move(data, moveX, moveY)\n this.drag(data)\n\n this.animate(step)\n interaction.emit(MoveEvent.DRAG_ANIMATE, data)\n }\n\n this.animate(step)\n }\n\n return dragAnimate\n}\n\ndragger.animate = function (func?: IFunction, off?: 'off'): void { // dragEnd animation\n const animateWait = func || this.animateWait\n if (animateWait) this.interaction.target.nextRender(animateWait, null, off)\n this.animateWait = func\n}\n\ndragger.stopAnimate = function (): void {\n this.animate(null, 'off')\n this.interaction.target.nextRender(() => {\n if (this.dragData) this.dragEndReal(this.dragData)\n })\n}\n\ndragger.checkDragOut = function (data: IPointerEvent): void {\n const { interaction } = this\n this.autoMoveCancel()\n if (this.dragging && !interaction.shrinkCanvasBounds.hitPoint(data)) this.autoMoveOnDragOut(data)\n}\n\ndragger.autoMoveOnDragOut = function (data: IPointerEvent): void {\n const { interaction, downData, canDragOut } = this\n const { autoDistance, dragOut } = interaction.m\n if (!dragOut || !canDragOut || !autoDistance) return\n\n const bounds = interaction.shrinkCanvasBounds\n const { x, y } = bounds\n const right = BoundsHelper.maxX(bounds)\n const bottom = BoundsHelper.maxY(bounds)\n\n const moveX = data.x < x ? autoDistance : (right < data.x ? -autoDistance : 0)\n const moveY = data.y < y ? autoDistance : (bottom < data.y ? -autoDistance : 0)\n let totalX = 0, totalY = 0\n\n this.autoMoveTimer = setInterval(() => {\n totalX += moveX\n totalY += moveY\n\n PointHelper.move(downData, moveX, moveY)\n PointHelper.move(this.dragData, moveX, moveY)\n\n interaction.move({ ...data, moveX, moveY, totalX, totalY, moveType: 'drag' })\n interaction.pointerMoveReal(data)\n }, 10)\n}\n\ndragger.autoMoveCancel = function (): void {\n if (this.autoMoveTimer) {\n clearInterval(this.autoMoveTimer)\n this.autoMoveTimer = 0\n }\n}","export { LeaferTypeCreator } from './LeaferTypeCreator'\nexport { addViewport, addViewportConfig } from './type/viewport'\nexport { MultiTouchHelper } from './interaction/MultiTouchHelper'\nexport { WheelEventHelper } from './interaction/WheelEventHelper'\nexport { Transformer } from './interaction/Transformer'\n\nimport { Plugin } from '@leafer-ui/core'\n\nimport './Leafer'\nimport './interaction/Interaction'\nimport './interaction/Dragger'\n\nPlugin.add('viewport')"],"names":["getScrollType","leafer","scroll","disabled","app","config","move","addViewport","mergeConfig","custom","addViewportConfig","parentApp","isApp","__eventIds","push","on_","MoveEvent","BEFORE_MOVE","e","getValidMove","moveX","moveY","includes","testMove","x","y","maxX","maxY","resistance","moveType","Math","abs","zoomLayer","DRAG_ANIMATE","interaction","stopDragAnimate","END","LeafHelper","animateMove","ZoomEvent","BEFORE_ZOOM","changeScale","getValidScale","scale","scaleOfWorld","viewportConfig","wheel","preventDefault","touch","pointer","preventDefaultMenu","DataHelper","assign","userConfig","debug","Debug","get","LeaferTypeCreator","list","register","name","fn","repeat","run","zoom","min","max","holdSpaceKey","holdMiddleKey","MultiTouchHelper","state","type","typeCount","startTime","totalData","center","getData","a","b","lastCenter","PointHelper","getCenter","from","to","lastDistance","getDistance","rotation","getRotation","getType","data","moveScore","hypot","scaleScore","rotateScore","detect","M","Date","now","add","count","time","reset","sign","within","MathHelper","WheelEventHelper","getMove","event","moveSpeed","deltaX","deltaY","shiftKey","absX","absY","getScale","zoomMode","zoomSpeed","delta","Platform","intWheelDeltaY","ceil","metaKey","ctrlKey","absScale","totalX","totalY","totalScale","totalRotation","Transformer","transforming","this","moving","zooming","rotating","moveData","zoomData","rotateData","constructor","setPath","Object","emit","START","path","MOVE","transformEndWait","ZOOM","rotate","RotateEvent","BEFORE_ROTATE","ROTATE","selector","getByPoint","hitRadius","cancelHover","clearTimeout","transformTimer","setTimeout","transformEnd","p","transformTime","destroy","Leafer","prototype","bounds","Bounds","Point","getMoveEventData","getZoomEventData","initType","checkLimit","set","scrollType","__world","addPoint","DragBoundsHelper","canvas","scaleX","__","InteractionBase","createTransformer","transformer","posDeltaSpeed","negDeltaSpeed","snap","round","multiTouch","singleGesture","pointerWaitCancel","gestureData","isObject","dragger","Dragger","checkDragEndAnimate","dragAnimate","canAnimate","m","inertia","isNumber","stopMove","maxMove","weight","s","frame","flickSpeed","totalWeight","w","dragDataList","len","length","i","boost","maxAbs","step","dragEndReal","drag","animate","func","off","animateWait","target","nextRender","stopAnimate","dragData","checkDragOut","autoMoveCancel","dragging","shrinkCanvasBounds","hitPoint","autoMoveOnDragOut","downData","canDragOut","autoDistance","dragOut","right","BoundsHelper","bottom","autoMoveTimer","setInterval","pointerMoveReal","clearInterval","Plugin"],"mappings":"8CAGM,SAAUA,EAAcC,GAC1B,MAAMC,OAAEA,EAAMC,SAAEA,GAAaF,EAAOG,IAAIC,OAAOC,KAC/C,OAASJ,GAAUC,EAAY,IAAiB,IAAXD,EAAkB,OAASA,CACpE,UCCgBK,EAAYN,EAAqBO,EAA6BC,GAC1EC,EAAkBT,EAAOU,UAAYV,EAAOU,UAAYV,EAAQO,GAC5DP,EAAOW,OAASH,GAEpBR,EAAOY,WAAWC,KACdb,EAAOc,IAAIC,YAAUC,YAAcC,IAC/B,MAAMZ,EAAOL,EAAOkB,aAAaD,EAAEE,MAAOF,EAAEG,OAAO,GAGnD,GAAIrB,EAAcC,GAAQqB,SAAS,SAAU,CACzC,MAAMC,EAAWtB,EAAOkB,aAAa,EAAG,GACxC,GAAII,EAASC,GAAKD,EAASE,EAAG,CAC1B,MAAMC,EAAO,IAAKC,EAAO,IAAKC,EAA4B,SAAfV,E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AAK0G,eACnB1G,KAAK0G,cAAgB,EAE7B,EC7GAI,EAAAA,OAAO9I,IAAI"}
|
package/dist/viewport.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
this.LeaferIN=this.LeaferIN||{},this.LeaferIN.viewport=function(t,e){"use strict";function o(t,o,
|
|
1
|
+
this.LeaferIN=this.LeaferIN||{},this.LeaferIN.viewport=function(t,e){"use strict";function o(t){const{scroll:e,disabled:o}=t.app.config.move;return!e||o?"":!0===e?"free":e}function a(t,a,i){n(t.parentApp?t.parentApp:t,a),t.isApp||i||t.__eventIds.push(t.on_(e.MoveEvent.BEFORE_MOVE,e=>{const a=t.getValidMove(e.moveX,e.moveY,!1);if(o(t).includes("limit")){const o=t.getValidMove(0,0);if(o.x||o.y){const t=100,n=200,i="drag"===e.moveType?.3:.05;Math.abs(o.x)>t?a.x=0:a.x*=i,Math.abs(o.y)>n?a.y=0:a.y*=i}}t.zoomLayer.move(a)}),t.on_(e.MoveEvent.DRAG_ANIMATE,()=>{const e=t.getValidMove(0,0);(e.x||e.y)&&t.interaction.stopDragAnimate()}),t.on_(e.MoveEvent.END,o=>{e.LeafHelper.animateMove(t.zoomLayer,t.getValidMove(o.moveX,o.moveY))}),t.on_(e.ZoomEvent.BEFORE_ZOOM,e=>{const{zoomLayer:o}=t,a=t.getValidScale(e.scale);1!==a&&o.scaleOfWorld(e,a)}))}function n(t,o){const a={wheel:{preventDefault:!0},touch:{preventDefault:!0},pointer:{preventDefaultMenu:!0}};o&&e.DataHelper.assign(a,o),e.DataHelper.assign(t.config,a,t.userConfig)}const i=e.Debug.get("LeaferTypeCreator"),s={list:{},register(t,e){r[t]&&i.repeat(t),r[t]=e},run(t,e){const o=r[t];o&&o(e)}},{list:r,register:c}=s;c("viewport",a),c("custom",function(t){a(t,null,!0)}),c("design",function(t){a(t,{zoom:{min:.01,max:256},move:{holdSpaceKey:!0,holdMiddleKey:!0}})}),c("document",function(t){a(t,{zoom:{min:1},move:{scroll:"limit"}})});const m={state:{type:"none",typeCount:0,startTime:0,totalData:null,center:{}},getData(t){const o=t[0],a=t[1],n=e.PointHelper.getCenter(o.from,a.from),i=e.PointHelper.getCenter(o.to,a.to),s={x:i.x-n.x,y:i.y-n.y},r=e.PointHelper.getDistance(o.from,a.from);return{move:s,scale:e.PointHelper.getDistance(o.to,a.to)/r,rotation:e.PointHelper.getRotation(o.from,a.from,o.to,a.to),center:i}},getType(t,e){const o=Math.hypot(t.move.x,t.move.y)/(e.move||5),a=Math.abs(t.scale-1)/(e.scale||.03),n=Math.abs(t.rotation)/(e.rotation||2);return o<1&&a<1&&n<1?"none":o>=a&&o>=n?"move":a>=n?"zoom":"rotate"},detect(t,e){const{state:o}=l,a=l.getType(t,e);if(o.totalData||(o.startTime=Date.now(),o.center=t.center),l.add(t,o.totalData),o.totalData=t,a===o.type){if(o.typeCount++,o.typeCount>=(e.count||3)&&"none"!==a)return a}else o.type=a,o.typeCount=1;return Date.now()-o.startTime>=(e.time||160)?l.getType(o.totalData,e):"none"},add(t,o){o&&(e.PointHelper.move(t.move,o.move),t.scale*=o.scale,t.rotation+=o.rotation,t.center=o.center)},reset(){const{state:t}=l;t.type="none",t.typeCount=0,t.startTime=0,t.totalData=null}},l=m,{abs:h,max:u}=Math,{sign:v,within:g}=e.MathHelper,d={getMove(t,e){let{moveSpeed:o}=e,{deltaX:a,deltaY:n}=t;t.shiftKey&&!a&&(a=n,n=0);const i=h(a),s=h(n);return i>50&&(a=u(50,i/3)*v(a)),s>50&&(n=u(50,s/3)*v(n)),{x:-a*o*2,y:-n*o*2}},getScale(t,o){let a,n=1,{zoomMode:i,zoomSpeed:s}=o;const r=t.deltaY||t.deltaX;if(i?(a="mouse"===i||!t.deltaX&&(e.Platform.intWheelDeltaY?Math.abs(r)>17:Math.ceil(r)!==r),(t.shiftKey||t.metaKey||t.ctrlKey)&&(a=!0)):a=!t.shiftKey&&(t.metaKey||t.ctrlKey),a){s=g(s,0,1);const e=t.deltaY?o.delta.y:o.delta.x,a=g(1-h(r)/(4*e)*s,.5,2);n=r>0?a:1/a}return n}};let f,p,y,D;class M{get transforming(){return this.moving||this.zooming||this.rotating}get moving(){return!!this.moveData}get zooming(){return!!this.zoomData}get rotating(){return!!this.rotateData}constructor(t){this.interaction=t}move(t){const{interaction:o}=this;t.moveType||(t.moveType="move"),this.moveData||(this.setPath(t),f=0,p=0,this.moveData=Object.assign(Object.assign({},t),{moveX:0,moveY:0,totalX:f,totalY:p}),o.emit(e.MoveEvent.START,this.moveData)),t.path=this.moveData.path,t.totalX=f+=t.moveX,t.totalY=p+=t.moveY,o.emit(e.MoveEvent.BEFORE_MOVE,t),o.emit(e.MoveEvent.MOVE,t),this.transformEndWait()}zoom(t){const{interaction:o}=this;this.zoomData||(this.setPath(t),y=1,this.zoomData=Object.assign(Object.assign({},t),{scale:1,totalScale:y}),o.emit(e.ZoomEvent.START,this.zoomData)),t.path=this.zoomData.path,t.totalScale=y*=t.scale,o.emit(e.ZoomEvent.BEFORE_ZOOM,t),o.emit(e.ZoomEvent.ZOOM,t),this.transformEndWait()}rotate(t){const{interaction:o}=this;this.rotateData||(this.setPath(t),D=0,this.rotateData=Object.assign(Object.assign({},t),{rotation:0,totalRotation:D}),o.emit(e.RotateEvent.START,this.rotateData)),t.path=this.rotateData.path,t.totalRotation=D+=t.rotation,o.emit(e.RotateEvent.BEFORE_ROTATE,t),o.emit(e.RotateEvent.ROTATE,t),this.transformEndWait()}setPath(t){const{interaction:e}=this,{path:o}=e.selector.getByPoint(t,e.hitRadius);t.path=o,e.cancelHover()}transformEndWait(){clearTimeout(this.transformTimer),this.transformTimer=setTimeout(()=>{this.transformEnd()},this.interaction.p.transformTime)}transformEnd(){const{interaction:t,moveData:o,zoomData:a,rotateData:n}=this;o&&t.emit(e.MoveEvent.END,Object.assign(Object.assign({},o),{totalX:f,totalY:p})),a&&t.emit(e.ZoomEvent.END,Object.assign(Object.assign({},a),{totalScale:y})),n&&t.emit(e.RotateEvent.END,Object.assign(Object.assign({},n),{totalRotation:D})),this.reset()}reset(){this.zoomData=this.moveData=this.rotateData=null}destroy(){this.reset()}}const E=e.Leafer.prototype,O=new e.Bounds,b=new e.Point;function T(t,e){return Object.assign(Object.assign({},e),{moveX:t.x,moveY:t.y})}function x(t,e){return Object.assign(Object.assign({},e),{scale:t})}E.initType=function(t){s.run(t,this)},E.getValidMove=function(t,a,n=!0){const{disabled:i}=this.app.config.move;b.set(t,a);const s=o(this);return s&&(s.includes("x")?b.y=0:s.includes("y")?b.x=0:Math.abs(b.x)>Math.abs(b.y)?b.y=0:b.x=0,n&&s.includes("limit")&&(O.set(this.__world).addPoint(this.zoomLayer),e.DragBoundsHelper.getValidMove(O,this.canvas.bounds,"auto",b,!0),s.includes("x")?b.y=0:s.includes("y")&&(b.x=0))),{x:i?0:b.x,y:i?0:b.y}},E.getValidScale=function(t){const{scaleX:e}=this.zoomLayer.__,{min:o,max:a,disabled:n}=this.app.config.zoom,i=Math.abs(e*t);return o&&i<o?t=o/e:a&&i>a&&(t=a/e),n?1:t};const z=e.InteractionBase.prototype;z.createTransformer=function(){this.transformer=new M(this)},z.move=function(t){this.transformer.move(t)},z.zoom=function(t){this.transformer.zoom(t)},z.rotate=function(t){this.transformer.rotate(t)},z.transformEnd=function(){this.transformer.transformEnd()},z.wheel=function(t){const{wheel:o,pointer:a}=this.config,{posDeltaSpeed:n,negDeltaSpeed:i}=o;if(o.disabled)return;t.deltaX>0?n&&(t.deltaX*=n):i&&(t.deltaX*=i),t.deltaY>0?n&&(t.deltaY*=n):i&&(t.deltaY*=i);const s=o.getScale?o.getScale(t,o):d.getScale(t,o);if(1!==s)this.zoom(x(s,t));else{const n=o.getMove?o.getMove(t,o):d.getMove(t,o);a.snap&&e.PointHelper.round(n),this.move(T(n,t))}},z.multiTouch=function(t,o){const{disabled:a,singleGesture:n}=this.config.multiTouch;if(a)return;this.pointerWaitCancel();let i=m.getData(o),{moving:s,zooming:r,rotating:c}=this.transformer;if(n){if(!this.transformer.transforming){switch(m.detect(i,e.isObject(n)?n:{})){case"move":s=!0;break;case"zoom":r=!0;break;case"rotate":c=!0;break;default:return}m.reset()}s||(i.center=m.state.center)}else s=r=c=!0;var l,h;Object.assign(t,i.center),t.multiTouch=!0,c&&this.rotate((l=i.rotation,h=t,Object.assign(Object.assign({},h),{rotation:l}))),r&&this.zoom(x(i.scale,t)),s&&this.move(T(i.move,t))};const R=e.Dragger.prototype,{abs:j,min:H,max:P,hypot:X}=Math;return R.checkDragEndAnimate=function(t){const{interaction:o}=this,a=this.canAnimate&&this.moving&&o.m.dragAnimate;if(a){const n=e.isNumber(a)?a:.95,i=.15,s=150;let r,c,m,l=0,h=0,u=0,v=0,g=3;const{dragDataList:d}=this,f=d.length;for(let t=f-1;t>=P(f-3,0)&&(m=d[t],!(m.time&&Date.now()-m.time>100));t--)r=g--,l+=m.moveX*r,h+=m.moveY*r,v+=r,c=X(m.moveX,m.moveY),c>u&&(u=c);if(v&&(l/=v,h/=v),u>8){const t=1.15+H((u-8)/17,1)*(1.6-1.15);l*=t,h*=t}const p=P(j(l),j(h));p>s&&(c=s/p,l*=c,h*=c);const y=()=>{if(l*=n,h*=n,t=Object.assign({},t),j(l)<i&&j(h)<i)return this.dragEndReal(t);e.PointHelper.move(t,l,h),this.drag(t),this.animate(y),o.emit(e.MoveEvent.DRAG_ANIMATE,t)};this.animate(y)}return a},R.animate=function(t,e){const o=t||this.animateWait;o&&this.interaction.target.nextRender(o,null,e),this.animateWait=t},R.stopAnimate=function(){this.animate(null,"off"),this.interaction.target.nextRender(()=>{this.dragData&&this.dragEndReal(this.dragData)})},R.checkDragOut=function(t){const{interaction:e}=this;this.autoMoveCancel(),this.dragging&&!e.shrinkCanvasBounds.hitPoint(t)&&this.autoMoveOnDragOut(t)},R.autoMoveOnDragOut=function(t){const{interaction:o,downData:a,canDragOut:n}=this,{autoDistance:i,dragOut:s}=o.m;if(!s||!n||!i)return;const r=o.shrinkCanvasBounds,{x:c,y:m}=r,l=e.BoundsHelper.maxX(r),h=e.BoundsHelper.maxY(r),u=t.x<c?i:l<t.x?-i:0,v=t.y<m?i:h<t.y?-i:0;let g=0,d=0;this.autoMoveTimer=setInterval(()=>{g+=u,d+=v,e.PointHelper.move(a,u,v),e.PointHelper.move(this.dragData,u,v),o.move(Object.assign(Object.assign({},t),{moveX:u,moveY:v,totalX:g,totalY:d,moveType:"drag"})),o.pointerMoveReal(t)},10)},R.autoMoveCancel=function(){this.autoMoveTimer&&(clearInterval(this.autoMoveTimer),this.autoMoveTimer=0)},e.Plugin.add("viewport"),t.LeaferTypeCreator=s,t.MultiTouchHelper=m,t.Transformer=M,t.WheelEventHelper=d,t.addViewport=a,t.addViewportConfig=n,t}({},LeaferUI);
|
|
2
2
|
//# sourceMappingURL=viewport.min.js.map
|
package/dist/viewport.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.min.js","sources":["../../../../../../src/in/packages/viewport/src/type/viewport.ts","../../../../../../src/in/packages/viewport/src/LeaferTypeCreator.ts","../../../../../../src/in/packages/viewport/src/type/custom.ts","../../../../../../src/in/packages/viewport/src/type/design.ts","../../../../../../src/in/packages/viewport/src/type/document.ts","../../../../../../src/in/packages/viewport/src/interaction/MultiTouchHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/WheelEventHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/Transformer.ts","../../../../../../src/in/packages/viewport/src/Leafer.ts","../../../../../../src/in/packages/viewport/src/interaction/Interaction.ts","../../../../../../src/in/packages/viewport/src/interaction/Dragger.ts","../../../../../../src/in/packages/viewport/src/index.ts"],"sourcesContent":["import { ILeaferBase, ILeaferConfig } from '@leafer-ui/interface'\n\nimport { MoveEvent, ZoomEvent, DataHelper, LeafHelper } from '@leafer-ui/core'\n\n\nexport function addViewport(leafer: ILeaferBase, mergeConfig?: ILeaferConfig, custom?: boolean): void {\n addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig)\n if (leafer.isApp || custom) return\n\n leafer.__eventIds.push(\n leafer.on_(MoveEvent.BEFORE_MOVE, (e: MoveEvent) => {\n const move = leafer.getValidMove(e.moveX, e.moveY, false)\n leafer.zoomLayer.move(move)\n }),\n leafer.on_(MoveEvent.DRAG_ANIMATE, () => {\n const move = leafer.getValidMove(0, 0)\n if (move.x || move.y) leafer.interaction.stopDragAnimate()\n }),\n leafer.on_(MoveEvent.END, (e: MoveEvent) => {\n LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY))\n }),\n leafer.on_(ZoomEvent.BEFORE_ZOOM, (e: ZoomEvent) => {\n const { zoomLayer } = leafer\n const changeScale = leafer.getValidScale(e.scale)\n if (changeScale !== 1) zoomLayer.scaleOfWorld(e, changeScale)\n })\n )\n}\n\nexport function addViewportConfig(leafer: ILeaferBase, mergeConfig?: ILeaferConfig): void {\n const viewportConfig: ILeaferConfig = {\n wheel: { preventDefault: true },\n touch: { preventDefault: true },\n pointer: { preventDefaultMenu: true }\n }\n if (mergeConfig) DataHelper.assign(viewportConfig, mergeConfig)\n DataHelper.assign(leafer.config, viewportConfig, leafer.userConfig)\n}","import { ILeaferBase, ILeaferTypeList, ILeaferTypeFunction } from '@leafer-ui/interface'\n\nimport { Debug } from '@leafer-ui/core'\n\nimport { addViewport } from './type/viewport'\nimport { custom } from './type/custom'\nimport { design } from './type/design'\nimport { document } from './type/document'\n\n\nconst debug = Debug.get('LeaferTypeCreator')\n\nexport const LeaferTypeCreator = {\n\n list: {} as ILeaferTypeList,\n\n register(name: string, fn: ILeaferTypeFunction): void {\n list[name] && debug.repeat(name)\n list[name] = fn\n },\n\n run(name: string, leafer: ILeaferBase): void {\n const fn = list[name]\n fn && fn(leafer)\n }\n\n}\n\nconst { list, register } = LeaferTypeCreator\n\nregister('viewport', addViewport)\nregister('custom', custom)\nregister('design', design)\nregister('document', document)","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function custom(leafer: ILeaferBase): void {\n addViewport(leafer, null, true)\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function design(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: {\n min: 0.01,\n max: 256\n },\n move: {\n holdSpaceKey: true,\n holdMiddleKey: true,\n }\n })\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function document(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: { min: 1 },\n move: { scroll: 'limit' }\n })\n}\n","import { IMultiTouchData, IKeepTouchData, IGestureType, IPointData, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { PointHelper } from '@leafer-ui/core'\n\n\nexport const MultiTouchHelper = {\n\n state: { // 单一手势识别状态\n type: 'none' as IGestureType,\n typeCount: 0,\n startTime: 0,\n totalData: null as IMultiTouchData,\n center: {} as IPointData\n },\n\n getData(list: IKeepTouchData[]): IMultiTouchData {\n const a = list[0], b = list[1]\n const lastCenter = PointHelper.getCenter(a.from, b.from)\n const center = PointHelper.getCenter(a.to, b.to)\n const move = { x: center.x - lastCenter.x, y: center.y - lastCenter.y }\n\n const lastDistance = PointHelper.getDistance(a.from, b.from)\n const distance = PointHelper.getDistance(a.to, b.to)\n const scale = distance / lastDistance\n\n const rotation = PointHelper.getRotation(a.from, b.from, a.to, b.to)\n return { move, scale, rotation, center }\n },\n\n getType(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const moveScore = Math.hypot(data.move.x, data.move.y) / (config.move || 5)\n const scaleScore = Math.abs(data.scale - 1) / (config.scale || 0.03)\n const rotateScore = Math.abs(data.rotation) / (config.rotation || 2)\n\n if (moveScore < 1 && scaleScore < 1 && rotateScore < 1) return 'none'\n if (moveScore >= scaleScore && moveScore >= rotateScore) return 'move'\n if (scaleScore >= rotateScore) return 'zoom'\n return 'rotate'\n },\n\n // 识别单一手势\n detect(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const { state } = M\n const type = M.getType(data, config)\n\n if (!state.totalData) {\n state.startTime = Date.now()\n state.center = data.center\n }\n\n M.add(data, state.totalData)\n state.totalData = data\n\n if (type === state.type) { // 连续多帧一样的类型才进行锁定\n state.typeCount++\n if (state.typeCount >= (config.count || 3) && type !== 'none') return type\n } else {\n state.type = type\n state.typeCount = 1\n }\n\n if ((Date.now() - state.startTime) >= (config.time || 160)) return M.getType(state.totalData, config) // 限制最长识别时间\n\n return 'none'\n },\n\n add(data: IMultiTouchData, add: IMultiTouchData): void {\n if (!add) return\n PointHelper.move(data.move, add.move)\n data.scale *= add.scale\n data.rotation += add.rotation\n data.center = add.center\n },\n\n reset() {\n const { state } = M\n state.type = 'none'\n state.typeCount = 0\n state.startTime = 0\n state.totalData = null\n }\n\n}\n\nconst M = MultiTouchHelper","import { IPointData, IWheelEvent, IWheelConfig } from '@leafer-ui/interface'\n\nimport { MathHelper, Platform } from '@leafer-ui/core'\n\n\nconst { abs, max } = Math, { sign, within } = MathHelper\n\nexport const WheelEventHelper = {\n\n getMove(event: IWheelEvent, config: IWheelConfig): IPointData {\n let { moveSpeed } = config\n let { deltaX, deltaY } = event\n if (event.shiftKey && !deltaX) { // Window\n deltaX = deltaY\n deltaY = 0\n }\n const absX = abs(deltaX), absY = abs(deltaY)\n if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX)\n if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY)\n return { x: -deltaX * moveSpeed * 2, y: -deltaY * moveSpeed * 2 }\n },\n\n getScale(event: IWheelEvent, config: IWheelConfig): number {\n\n let zoom: boolean\n let scale = 1\n let { zoomMode, zoomSpeed } = config\n\n const delta = event.deltaY || event.deltaX\n\n if (zoomMode) {\n // mac 触摸板滚动手势的deltaY是整数, 鼠标滚动/触摸板缩放的deltaY有小数点, firfox鼠标滚动为整数,为18或19的倍数\n // windows 始终是整数\n zoom = (zoomMode === 'mouse') ? true : (!event.deltaX && (Platform.intWheelDeltaY ? Math.abs(delta) > 17 : Math.ceil(delta) !== delta))\n if (event.shiftKey || event.metaKey || event.ctrlKey) zoom = true\n } else {\n zoom = !event.shiftKey && (event.metaKey || event.ctrlKey)\n }\n\n if (zoom) {\n zoomSpeed = within(zoomSpeed, 0, 1)\n const min = event.deltaY ? config.delta.y : config.delta.x\n const absScale = within(1 - abs(delta) / (min * 4) * zoomSpeed, 0.5, 2)\n scale = delta > 0 ? absScale : 1 / absScale // 让 scale 放大、缩小可以定位在有规律的刻度上\n }\n\n return scale\n }\n\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, ITimer } from '@leafer-ui/interface'\n\nimport { InteractionBase, MoveEvent, ZoomEvent, RotateEvent } from '@leafer-ui/core'\n\n\nlet totalX: number, totalY: number, totalScale: number, totalRotation: number\n\nexport class Transformer {\n\n public get transforming(): boolean { return this.moving || this.zooming || this.rotating }\n public get moving(): boolean { return !!this.moveData }\n public get zooming(): boolean { return !!this.zoomData }\n public get rotating(): boolean { return !!this.rotateData }\n\n public moveData: IMoveEvent\n public zoomData: IZoomEvent\n public rotateData: IRotateEvent\n\n protected interaction: InteractionBase\n protected transformTimer: ITimer\n\n constructor(interaction: InteractionBase) {\n this.interaction = interaction\n }\n\n public move(data: IMoveEvent): void {\n const { interaction } = this\n if (!data.moveType) data.moveType = 'move'\n\n if (!this.moveData) {\n this.setPath(data)\n totalX = 0, totalY = 0\n this.moveData = { ...data, moveX: 0, moveY: 0, totalX, totalY }\n interaction.emit(MoveEvent.START, this.moveData)\n }\n\n data.path = this.moveData.path\n data.totalX = totalX = totalX + data.moveX\n data.totalY = totalY = totalY + data.moveY\n interaction.emit(MoveEvent.BEFORE_MOVE, data)\n interaction.emit(MoveEvent.MOVE, data)\n\n this.transformEndWait()\n }\n\n public zoom(data: IZoomEvent): void {\n const { interaction } = this\n\n if (!this.zoomData) {\n this.setPath(data)\n totalScale = 1\n this.zoomData = { ...data, scale: 1, totalScale }\n interaction.emit(ZoomEvent.START, this.zoomData)\n }\n\n data.path = this.zoomData.path\n data.totalScale = totalScale = totalScale * data.scale\n interaction.emit(ZoomEvent.BEFORE_ZOOM, data)\n interaction.emit(ZoomEvent.ZOOM, data)\n\n this.transformEndWait()\n }\n\n public rotate(data: IRotateEvent): void {\n const { interaction } = this\n\n if (!this.rotateData) {\n this.setPath(data)\n totalRotation = 0\n this.rotateData = { ...data, rotation: 0, totalRotation }\n interaction.emit(RotateEvent.START, this.rotateData)\n }\n\n data.path = this.rotateData.path\n data.totalRotation = totalRotation = totalRotation + data.rotation\n interaction.emit(RotateEvent.BEFORE_ROTATE, data)\n interaction.emit(RotateEvent.ROTATE, data)\n\n this.transformEndWait()\n }\n\n public setPath(data: any): void {\n const { interaction } = this\n const { path } = interaction.selector.getByPoint(data, interaction.hitRadius)\n data.path = path\n interaction.cancelHover()\n }\n\n protected transformEndWait(): void {\n clearTimeout(this.transformTimer)\n this.transformTimer = setTimeout(() => {\n this.transformEnd()\n }, this.interaction.p.transformTime)\n }\n\n public transformEnd(): void {\n const { interaction, moveData, zoomData, rotateData } = this\n if (moveData) interaction.emit(MoveEvent.END, { ...moveData, totalX, totalY } as IMoveEvent)\n if (zoomData) interaction.emit(ZoomEvent.END, { ...zoomData, totalScale } as IZoomEvent)\n if (rotateData) interaction.emit(RotateEvent.END, { ...rotateData, totalRotation } as IRotateEvent)\n this.reset()\n }\n\n public reset(): void {\n this.zoomData = this.moveData = this.rotateData = null\n }\n\n public destroy(): void {\n this.reset()\n }\n}","import { ILeaferType, IPointData } from '@leafer-ui/interface'\n\nimport { Leafer, Bounds, Point, DragBoundsHelper } from '@leafer-ui/core'\n\nimport { LeaferTypeCreator } from './LeaferTypeCreator'\n\n\nconst leafer = Leafer.prototype\nconst bounds = new Bounds(), move = new Point()\n\nleafer.initType = function (type: ILeaferType) {\n LeaferTypeCreator.run(type, this)\n}\n\nleafer.getValidMove = function (moveX: number, moveY: number, checkLimit = true): IPointData {\n const { scroll, disabled } = this.app.config.move\n move.set(moveX, moveY)\n\n if (scroll) {\n const type = scroll === true ? '' : scroll\n\n if (type.includes('x')) move.y = 0\n else if (type.includes('y')) move.x = 0\n else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0\n\n if (checkLimit && type.includes('limit')) {\n bounds.set(this.__world).addPoint(this.zoomLayer as IPointData)\n DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, 'auto', move, true)\n if (type.includes('x')) move.y = 0\n else if (type.includes('y')) move.x = 0\n }\n }\n\n return { x: disabled ? 0 : move.x, y: disabled ? 0 : move.y }\n}\n\nleafer.getValidScale = function (changeScale: number): number {\n const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale)\n if (min && absScale < min) changeScale = min / scaleX\n else if (max && absScale > max) changeScale = max / scaleX\n return disabled ? 1 : changeScale // fix 不能过滤小数位\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, IKeepTouchData, IPointData, IEvent, IPointerEvent, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { InteractionBase, PointHelper, isObject } from '@leafer-ui/core'\n\nimport { WheelEventHelper } from './WheelEventHelper'\nimport { Transformer } from './Transformer'\nimport { MultiTouchHelper } from './MultiTouchHelper'\n\n\nfunction getMoveEventData(move: IPointData, event: IEvent): IMoveEvent {\n return { ...event, moveX: move.x, moveY: move.y } as IMoveEvent\n}\n\nfunction getRotateEventData(rotation: number, event: IEvent): IRotateEvent {\n return { ...event, rotation } as IRotateEvent\n}\n\nfunction getZoomEventData(scale: number, event: IEvent): IZoomEvent {\n return { ...event, scale, } as IZoomEvent\n}\n\n\nconst interaction = InteractionBase.prototype\n\ninteraction.createTransformer = function (): void {\n this.transformer = new Transformer(this)\n}\n\ninteraction.move = function (data: IMoveEvent): void {\n this.transformer.move(data)\n}\n\ninteraction.zoom = function (data: IZoomEvent): void {\n this.transformer.zoom(data)\n}\n\ninteraction.rotate = function (data: IRotateEvent): void {\n this.transformer.rotate(data)\n}\n\ninteraction.transformEnd = function (): void {\n this.transformer.transformEnd()\n}\n\n\ninteraction.wheel = function (data: IWheelEvent): void {\n const { wheel, pointer } = this.config, { posDeltaSpeed, negDeltaSpeed } = wheel\n if (wheel.disabled) return\n\n if (data.deltaX > 0) posDeltaSpeed && (data.deltaX *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaX *= negDeltaSpeed)\n\n if (data.deltaY > 0) posDeltaSpeed && (data.deltaY *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaY *= negDeltaSpeed)\n\n const scale = wheel.getScale ? wheel.getScale(data, wheel) : WheelEventHelper.getScale(data, wheel)\n if (scale !== 1) this.zoom(getZoomEventData(scale, data))\n else {\n const move = wheel.getMove ? wheel.getMove(data, wheel) : WheelEventHelper.getMove(data, wheel)\n if (pointer.snap) PointHelper.round(move)\n this.move(getMoveEventData(move, data))\n }\n}\n\n\ninteraction.multiTouch = function (data: IPointerEvent, list: IKeepTouchData[]): void {\n const { disabled, singleGesture } = this.config.multiTouch\n if (disabled) return\n this.pointerWaitCancel()\n\n let gestureData = MultiTouchHelper.getData(list)\n let { moving, zooming, rotating } = this.transformer\n\n if (singleGesture) {\n\n if (!this.transformer.transforming) {\n\n const type = MultiTouchHelper.detect(gestureData, isObject(singleGesture) ? singleGesture : {} as ISingleGestureConfig)\n\n switch (type) {\n case 'move': moving = true; break\n case 'zoom': zooming = true; break\n case 'rotate': rotating = true; break\n default: return\n }\n\n MultiTouchHelper.reset()\n\n }\n\n if (!moving) gestureData.center = MultiTouchHelper.state.center\n\n } else moving = zooming = rotating = true\n\n Object.assign(data, gestureData.center)\n data.multiTouch = true\n\n if (rotating) this.rotate(getRotateEventData(gestureData.rotation, data))\n if (zooming) this.zoom(getZoomEventData(gestureData.scale, data))\n if (moving) this.move(getMoveEventData(gestureData.move, data))\n}","import { IPointerEvent, IFunction, IDragEvent } from '@leafer-ui/interface'\n\nimport { Dragger, BoundsHelper, PointHelper, MoveEvent, isNumber } from '@leafer-ui/core'\n\n\nconst dragger = Dragger.prototype\nconst { abs, min, max, hypot } = Math\n\ndragger.checkDragEndAnimate = function (data: IPointerEvent): boolean | number {\n const { interaction } = this\n const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate\n\n if (dragAnimate) {\n\n const inertia = isNumber(dragAnimate) ? dragAnimate : 0.95\n const stopMove = 0.15\n const maxMove = 150\n\n let moveX = 0, moveY = 0, flickSpeed = 0 // 快速滑动加速\n let totalWeight = 0, weight: number, w = 3, s: number, frame: IDragEvent\n\n const { dragDataList } = this, len = dragDataList.length\n for (let i = len - 1; i >= max(len - 3, 0); i--) {\n frame = dragDataList[i]\n if (frame.time && (Date.now() - frame.time > 100)) break\n weight = w--\n\n moveX += frame.moveX * weight\n moveY += frame.moveY * weight\n totalWeight += weight\n\n s = hypot(frame.moveX, frame.moveY)\n if (s > flickSpeed) flickSpeed = s\n }\n\n if (totalWeight) moveX /= totalWeight, moveY /= totalWeight\n\n if (flickSpeed > 8) {\n const t = min((flickSpeed - 8) / 17, 1)\n const boost = 1.15 + t * (1.6 - 1.15)\n moveX *= boost\n moveY *= boost\n }\n\n const maxAbs = max(abs(moveX), abs(moveY))\n if (maxAbs > maxMove) {\n s = maxMove / maxAbs\n moveX *= s\n moveY *= s\n }\n\n const step = () => {\n moveX *= inertia\n moveY *= inertia\n\n data = { ...data }\n if (abs(moveX) < stopMove && abs(moveY) < stopMove) return this.dragEndReal(data)\n\n PointHelper.move(data, moveX, moveY)\n this.drag(data)\n\n this.animate(step)\n interaction.emit(MoveEvent.DRAG_ANIMATE, data)\n }\n\n this.animate(step)\n }\n\n return dragAnimate\n}\n\ndragger.animate = function (func?: IFunction, off?: 'off'): void { // dragEnd animation\n const animateWait = func || this.animateWait\n if (animateWait) this.interaction.target.nextRender(animateWait, null, off)\n this.animateWait = func\n}\n\ndragger.stopAnimate = function (): void {\n this.animate(null, 'off')\n this.interaction.target.nextRender(() => {\n if (this.dragData) this.dragEndReal(this.dragData)\n })\n}\n\ndragger.checkDragOut = function (data: IPointerEvent): void {\n const { interaction } = this\n this.autoMoveCancel()\n if (this.dragging && !interaction.shrinkCanvasBounds.hitPoint(data)) this.autoMoveOnDragOut(data)\n}\n\ndragger.autoMoveOnDragOut = function (data: IPointerEvent): void {\n const { interaction, downData, canDragOut } = this\n const { autoDistance, dragOut } = interaction.m\n if (!dragOut || !canDragOut || !autoDistance) return\n\n const bounds = interaction.shrinkCanvasBounds\n const { x, y } = bounds\n const right = BoundsHelper.maxX(bounds)\n const bottom = BoundsHelper.maxY(bounds)\n\n const moveX = data.x < x ? autoDistance : (right < data.x ? -autoDistance : 0)\n const moveY = data.y < y ? autoDistance : (bottom < data.y ? -autoDistance : 0)\n let totalX = 0, totalY = 0\n\n this.autoMoveTimer = setInterval(() => {\n totalX += moveX\n totalY += moveY\n\n PointHelper.move(downData, moveX, moveY)\n PointHelper.move(this.dragData, moveX, moveY)\n\n interaction.move({ ...data, moveX, moveY, totalX, totalY, moveType: 'drag' })\n interaction.pointerMoveReal(data)\n }, 10)\n}\n\ndragger.autoMoveCancel = function (): void {\n if (this.autoMoveTimer) {\n clearInterval(this.autoMoveTimer)\n this.autoMoveTimer = 0\n }\n}","export { LeaferTypeCreator } from './LeaferTypeCreator'\nexport { addViewport, addViewportConfig } from './type/viewport'\nexport { MultiTouchHelper } from './interaction/MultiTouchHelper'\nexport { WheelEventHelper } from './interaction/WheelEventHelper'\nexport { Transformer } from './interaction/Transformer'\n\nimport { Plugin } from '@leafer-ui/core'\n\nimport './Leafer'\nimport './interaction/Interaction'\nimport './interaction/Dragger'\n\nPlugin.add('viewport')"],"names":["addViewport","leafer","mergeConfig","custom","addViewportConfig","parentApp","isApp","__eventIds","push","on_","MoveEvent","BEFORE_MOVE","e","move","getValidMove","moveX","moveY","zoomLayer","DRAG_ANIMATE","x","y","interaction","stopDragAnimate","END","LeafHelper","animateMove","ZoomEvent","BEFORE_ZOOM","changeScale","getValidScale","scale","scaleOfWorld","viewportConfig","wheel","preventDefault","touch","pointer","preventDefaultMenu","DataHelper","assign","config","userConfig","debug","Debug","get","LeaferTypeCreator","list","register","name","fn","repeat","run","zoom","min","max","holdSpaceKey","holdMiddleKey","scroll","MultiTouchHelper","state","type","typeCount","startTime","totalData","center","getData","a","b","lastCenter","PointHelper","getCenter","from","to","lastDistance","getDistance","rotation","getRotation","getType","data","moveScore","Math","hypot","scaleScore","abs","rotateScore","detect","M","Date","now","add","count","time","reset","sign","within","MathHelper","WheelEventHelper","getMove","event","moveSpeed","deltaX","deltaY","shiftKey","absX","absY","getScale","zoomMode","zoomSpeed","delta","Platform","intWheelDeltaY","ceil","metaKey","ctrlKey","absScale","totalX","totalY","totalScale","totalRotation","Transformer","transforming","this","moving","zooming","rotating","moveData","zoomData","rotateData","constructor","moveType","setPath","Object","emit","START","path","MOVE","transformEndWait","ZOOM","rotate","RotateEvent","BEFORE_ROTATE","ROTATE","selector","getByPoint","hitRadius","cancelHover","clearTimeout","transformTimer","setTimeout","transformEnd","p","transformTime","destroy","Leafer","prototype","bounds","Bounds","Point","getMoveEventData","getZoomEventData","initType","checkLimit","disabled","app","set","includes","__world","addPoint","DragBoundsHelper","canvas","scaleX","__","InteractionBase","createTransformer","transformer","posDeltaSpeed","negDeltaSpeed","snap","round","multiTouch","singleGesture","pointerWaitCancel","gestureData","isObject","dragger","Dragger","checkDragEndAnimate","dragAnimate","canAnimate","m","inertia","isNumber","stopMove","maxMove","weight","s","frame","flickSpeed","totalWeight","w","dragDataList","len","length","i","boost","maxAbs","step","dragEndReal","drag","animate","func","off","animateWait","target","nextRender","stopAnimate","dragData","checkDragOut","autoMoveCancel","dragging","shrinkCanvasBounds","hitPoint","autoMoveOnDragOut","downData","canDragOut","autoDistance","dragOut","right","BoundsHelper","maxX","bottom","maxY","autoMoveTimer","setInterval","pointerMoveReal","clearInterval","Plugin"],"mappings":"2FAKgBA,EAAYC,EAAqBC,EAA6BC,GAC1EC,EAAkBH,EAAOI,UAAYJ,EAAOI,UAAYJ,EAAQC,GAC5DD,EAAOK,OAASH,GAEpBF,EAAOM,WAAWC,KAC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|
1
|
+
{"version":3,"file":"viewport.min.js","sources":["../../../../../../src/in/packages/viewport/src/helper.ts","../../../../../../src/in/packages/viewport/src/type/viewport.ts","../../../../../../src/in/packages/viewport/src/LeaferTypeCreator.ts","../../../../../../src/in/packages/viewport/src/type/custom.ts","../../../../../../src/in/packages/viewport/src/type/design.ts","../../../../../../src/in/packages/viewport/src/type/document.ts","../../../../../../src/in/packages/viewport/src/interaction/MultiTouchHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/WheelEventHelper.ts","../../../../../../src/in/packages/viewport/src/interaction/Transformer.ts","../../../../../../src/in/packages/viewport/src/Leafer.ts","../../../../../../src/in/packages/viewport/src/interaction/Interaction.ts","../../../../../../src/in/packages/viewport/src/interaction/Dragger.ts","../../../../../../src/in/packages/viewport/src/index.ts"],"sourcesContent":["import { ILeaferBase } from '@leafer-ui/interface'\n\n\nexport function getScrollType(leafer: ILeaferBase): string {\n const { scroll, disabled } = leafer.app.config.move\n return (!scroll || disabled) ? '' : (scroll === true ? 'free' : scroll)\n}","import { ILeaferBase, ILeaferConfig } from '@leafer-ui/interface'\n\nimport { MoveEvent, ZoomEvent, DataHelper, LeafHelper } from '@leafer-ui/core'\n\nimport { getScrollType } from '../helper'\n\n\nexport function addViewport(leafer: ILeaferBase, mergeConfig?: ILeaferConfig, custom?: boolean): void {\n addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig)\n if (leafer.isApp || custom) return\n\n leafer.__eventIds.push(\n leafer.on_(MoveEvent.BEFORE_MOVE, (e: MoveEvent) => {\n const move = leafer.getValidMove(e.moveX, e.moveY, false)\n\n // check limit\n if (getScrollType(leafer).includes('limit')) {\n const testMove = leafer.getValidMove(0, 0)\n if (testMove.x || testMove.y) {\n const maxX = 100, maxY = 200, resistance = e.moveType === 'drag' ? 0.3 : 0.05\n\n if (Math.abs(testMove.x) > maxX) move.x = 0\n else move.x *= resistance\n\n if (Math.abs(testMove.y) > maxY) move.y = 0\n else move.y *= resistance\n }\n }\n\n leafer.zoomLayer.move(move)\n }),\n leafer.on_(MoveEvent.DRAG_ANIMATE, () => {\n const testMove = leafer.getValidMove(0, 0)\n if (testMove.x || testMove.y) leafer.interaction.stopDragAnimate()\n }),\n leafer.on_(MoveEvent.END, (e: MoveEvent) => {\n LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY))\n }),\n leafer.on_(ZoomEvent.BEFORE_ZOOM, (e: ZoomEvent) => {\n const { zoomLayer } = leafer\n const changeScale = leafer.getValidScale(e.scale)\n if (changeScale !== 1) zoomLayer.scaleOfWorld(e, changeScale)\n })\n )\n}\n\nexport function addViewportConfig(leafer: ILeaferBase, mergeConfig?: ILeaferConfig): void {\n const viewportConfig: ILeaferConfig = {\n wheel: { preventDefault: true },\n touch: { preventDefault: true },\n pointer: { preventDefaultMenu: true }\n }\n if (mergeConfig) DataHelper.assign(viewportConfig, mergeConfig)\n DataHelper.assign(leafer.config, viewportConfig, leafer.userConfig)\n}","import { ILeaferBase, ILeaferTypeList, ILeaferTypeFunction } from '@leafer-ui/interface'\n\nimport { Debug } from '@leafer-ui/core'\n\nimport { addViewport } from './type/viewport'\nimport { custom } from './type/custom'\nimport { design } from './type/design'\nimport { document } from './type/document'\n\n\nconst debug = Debug.get('LeaferTypeCreator')\n\nexport const LeaferTypeCreator = {\n\n list: {} as ILeaferTypeList,\n\n register(name: string, fn: ILeaferTypeFunction): void {\n list[name] && debug.repeat(name)\n list[name] = fn\n },\n\n run(name: string, leafer: ILeaferBase): void {\n const fn = list[name]\n fn && fn(leafer)\n }\n\n}\n\nconst { list, register } = LeaferTypeCreator\n\nregister('viewport', addViewport)\nregister('custom', custom)\nregister('design', design)\nregister('document', document)","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function custom(leafer: ILeaferBase): void {\n addViewport(leafer, null, true)\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function design(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: {\n min: 0.01,\n max: 256\n },\n move: {\n holdSpaceKey: true,\n holdMiddleKey: true,\n }\n })\n}\n","import { ILeaferBase } from '@leafer-ui/interface'\n\nimport { addViewport } from './viewport'\n\n\nexport function document(leafer: ILeaferBase): void {\n addViewport(leafer, {\n zoom: { min: 1 },\n move: { scroll: 'limit' }\n })\n}\n","import { IMultiTouchData, IKeepTouchData, IGestureType, IPointData, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { PointHelper } from '@leafer-ui/core'\n\n\nexport const MultiTouchHelper = {\n\n state: { // 单一手势识别状态\n type: 'none' as IGestureType,\n typeCount: 0,\n startTime: 0,\n totalData: null as IMultiTouchData,\n center: {} as IPointData\n },\n\n getData(list: IKeepTouchData[]): IMultiTouchData {\n const a = list[0], b = list[1]\n const lastCenter = PointHelper.getCenter(a.from, b.from)\n const center = PointHelper.getCenter(a.to, b.to)\n const move = { x: center.x - lastCenter.x, y: center.y - lastCenter.y }\n\n const lastDistance = PointHelper.getDistance(a.from, b.from)\n const distance = PointHelper.getDistance(a.to, b.to)\n const scale = distance / lastDistance\n\n const rotation = PointHelper.getRotation(a.from, b.from, a.to, b.to)\n return { move, scale, rotation, center }\n },\n\n getType(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const moveScore = Math.hypot(data.move.x, data.move.y) / (config.move || 5)\n const scaleScore = Math.abs(data.scale - 1) / (config.scale || 0.03)\n const rotateScore = Math.abs(data.rotation) / (config.rotation || 2)\n\n if (moveScore < 1 && scaleScore < 1 && rotateScore < 1) return 'none'\n if (moveScore >= scaleScore && moveScore >= rotateScore) return 'move'\n if (scaleScore >= rotateScore) return 'zoom'\n return 'rotate'\n },\n\n // 识别单一手势\n detect(data: IMultiTouchData, config: ISingleGestureConfig): IGestureType {\n const { state } = M\n const type = M.getType(data, config)\n\n if (!state.totalData) {\n state.startTime = Date.now()\n state.center = data.center\n }\n\n M.add(data, state.totalData)\n state.totalData = data\n\n if (type === state.type) { // 连续多帧一样的类型才进行锁定\n state.typeCount++\n if (state.typeCount >= (config.count || 3) && type !== 'none') return type\n } else {\n state.type = type\n state.typeCount = 1\n }\n\n if ((Date.now() - state.startTime) >= (config.time || 160)) return M.getType(state.totalData, config) // 限制最长识别时间\n\n return 'none'\n },\n\n add(data: IMultiTouchData, add: IMultiTouchData): void {\n if (!add) return\n PointHelper.move(data.move, add.move)\n data.scale *= add.scale\n data.rotation += add.rotation\n data.center = add.center\n },\n\n reset() {\n const { state } = M\n state.type = 'none'\n state.typeCount = 0\n state.startTime = 0\n state.totalData = null\n }\n\n}\n\nconst M = MultiTouchHelper","import { IPointData, IWheelEvent, IWheelConfig } from '@leafer-ui/interface'\n\nimport { MathHelper, Platform } from '@leafer-ui/core'\n\n\nconst { abs, max } = Math, { sign, within } = MathHelper\n\nexport const WheelEventHelper = {\n\n getMove(event: IWheelEvent, config: IWheelConfig): IPointData {\n let { moveSpeed } = config\n let { deltaX, deltaY } = event\n if (event.shiftKey && !deltaX) { // Window\n deltaX = deltaY\n deltaY = 0\n }\n const absX = abs(deltaX), absY = abs(deltaY)\n if (absX > 50) deltaX = max(50, absX / 3) * sign(deltaX)\n if (absY > 50) deltaY = max(50, absY / 3) * sign(deltaY)\n return { x: -deltaX * moveSpeed * 2, y: -deltaY * moveSpeed * 2 }\n },\n\n getScale(event: IWheelEvent, config: IWheelConfig): number {\n\n let zoom: boolean\n let scale = 1\n let { zoomMode, zoomSpeed } = config\n\n const delta = event.deltaY || event.deltaX\n\n if (zoomMode) {\n // mac 触摸板滚动手势的deltaY是整数, 鼠标滚动/触摸板缩放的deltaY有小数点, firfox鼠标滚动为整数,为18或19的倍数\n // windows 始终是整数\n zoom = (zoomMode === 'mouse') ? true : (!event.deltaX && (Platform.intWheelDeltaY ? Math.abs(delta) > 17 : Math.ceil(delta) !== delta))\n if (event.shiftKey || event.metaKey || event.ctrlKey) zoom = true\n } else {\n zoom = !event.shiftKey && (event.metaKey || event.ctrlKey)\n }\n\n if (zoom) {\n zoomSpeed = within(zoomSpeed, 0, 1)\n const min = event.deltaY ? config.delta.y : config.delta.x\n const absScale = within(1 - abs(delta) / (min * 4) * zoomSpeed, 0.5, 2)\n scale = delta > 0 ? absScale : 1 / absScale // 让 scale 放大、缩小可以定位在有规律的刻度上\n }\n\n return scale\n }\n\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, ITimer } from '@leafer-ui/interface'\n\nimport { InteractionBase, MoveEvent, ZoomEvent, RotateEvent } from '@leafer-ui/core'\n\n\nlet totalX: number, totalY: number, totalScale: number, totalRotation: number\n\nexport class Transformer {\n\n public get transforming(): boolean { return this.moving || this.zooming || this.rotating }\n public get moving(): boolean { return !!this.moveData }\n public get zooming(): boolean { return !!this.zoomData }\n public get rotating(): boolean { return !!this.rotateData }\n\n public moveData: IMoveEvent\n public zoomData: IZoomEvent\n public rotateData: IRotateEvent\n\n protected interaction: InteractionBase\n protected transformTimer: ITimer\n\n constructor(interaction: InteractionBase) {\n this.interaction = interaction\n }\n\n public move(data: IMoveEvent): void {\n const { interaction } = this\n if (!data.moveType) data.moveType = 'move'\n\n if (!this.moveData) {\n this.setPath(data)\n totalX = 0, totalY = 0\n this.moveData = { ...data, moveX: 0, moveY: 0, totalX, totalY }\n interaction.emit(MoveEvent.START, this.moveData)\n }\n\n data.path = this.moveData.path\n data.totalX = totalX = totalX + data.moveX\n data.totalY = totalY = totalY + data.moveY\n interaction.emit(MoveEvent.BEFORE_MOVE, data)\n interaction.emit(MoveEvent.MOVE, data)\n\n this.transformEndWait()\n }\n\n public zoom(data: IZoomEvent): void {\n const { interaction } = this\n\n if (!this.zoomData) {\n this.setPath(data)\n totalScale = 1\n this.zoomData = { ...data, scale: 1, totalScale }\n interaction.emit(ZoomEvent.START, this.zoomData)\n }\n\n data.path = this.zoomData.path\n data.totalScale = totalScale = totalScale * data.scale\n interaction.emit(ZoomEvent.BEFORE_ZOOM, data)\n interaction.emit(ZoomEvent.ZOOM, data)\n\n this.transformEndWait()\n }\n\n public rotate(data: IRotateEvent): void {\n const { interaction } = this\n\n if (!this.rotateData) {\n this.setPath(data)\n totalRotation = 0\n this.rotateData = { ...data, rotation: 0, totalRotation }\n interaction.emit(RotateEvent.START, this.rotateData)\n }\n\n data.path = this.rotateData.path\n data.totalRotation = totalRotation = totalRotation + data.rotation\n interaction.emit(RotateEvent.BEFORE_ROTATE, data)\n interaction.emit(RotateEvent.ROTATE, data)\n\n this.transformEndWait()\n }\n\n public setPath(data: any): void {\n const { interaction } = this\n const { path } = interaction.selector.getByPoint(data, interaction.hitRadius)\n data.path = path\n interaction.cancelHover()\n }\n\n protected transformEndWait(): void {\n clearTimeout(this.transformTimer)\n this.transformTimer = setTimeout(() => {\n this.transformEnd()\n }, this.interaction.p.transformTime)\n }\n\n public transformEnd(): void {\n const { interaction, moveData, zoomData, rotateData } = this\n if (moveData) interaction.emit(MoveEvent.END, { ...moveData, totalX, totalY } as IMoveEvent)\n if (zoomData) interaction.emit(ZoomEvent.END, { ...zoomData, totalScale } as IZoomEvent)\n if (rotateData) interaction.emit(RotateEvent.END, { ...rotateData, totalRotation } as IRotateEvent)\n this.reset()\n }\n\n public reset(): void {\n this.zoomData = this.moveData = this.rotateData = null\n }\n\n public destroy(): void {\n this.reset()\n }\n}","import { ILeaferType, IPointData } from '@leafer-ui/interface'\n\nimport { Leafer, Bounds, Point, DragBoundsHelper } from '@leafer-ui/core'\n\nimport { LeaferTypeCreator } from './LeaferTypeCreator'\nimport { getScrollType } from './helper'\n\n\nconst leafer = Leafer.prototype\nconst bounds = new Bounds(), move = new Point()\n\nleafer.initType = function (type: ILeaferType) {\n LeaferTypeCreator.run(type, this)\n}\n\nleafer.getValidMove = function (moveX: number, moveY: number, checkLimit = true): IPointData {\n const { disabled } = this.app.config.move\n move.set(moveX, moveY)\n\n const scrollType = getScrollType(this)\n if (scrollType) {\n\n if (scrollType.includes('x')) move.y = 0\n else if (scrollType.includes('y')) move.x = 0\n else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0\n\n if (checkLimit && scrollType.includes('limit')) {\n bounds.set(this.__world).addPoint(this.zoomLayer as IPointData)\n DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, 'auto', move, true)\n if (scrollType.includes('x')) move.y = 0\n else if (scrollType.includes('y')) move.x = 0\n }\n }\n\n return { x: disabled ? 0 : move.x, y: disabled ? 0 : move.y }\n}\n\nleafer.getValidScale = function (changeScale: number): number {\n const { scaleX } = this.zoomLayer.__, { min, max, disabled } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale)\n if (min && absScale < min) changeScale = min / scaleX\n else if (max && absScale > max) changeScale = max / scaleX\n return disabled ? 1 : changeScale // fix 不能过滤小数位\n}","import { IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, IKeepTouchData, IPointData, IEvent, IPointerEvent, ISingleGestureConfig } from '@leafer-ui/interface'\n\nimport { InteractionBase, PointHelper, isObject } from '@leafer-ui/core'\n\nimport { WheelEventHelper } from './WheelEventHelper'\nimport { Transformer } from './Transformer'\nimport { MultiTouchHelper } from './MultiTouchHelper'\n\n\nfunction getMoveEventData(move: IPointData, event: IEvent): IMoveEvent {\n return { ...event, moveX: move.x, moveY: move.y } as IMoveEvent\n}\n\nfunction getRotateEventData(rotation: number, event: IEvent): IRotateEvent {\n return { ...event, rotation } as IRotateEvent\n}\n\nfunction getZoomEventData(scale: number, event: IEvent): IZoomEvent {\n return { ...event, scale, } as IZoomEvent\n}\n\n\nconst interaction = InteractionBase.prototype\n\ninteraction.createTransformer = function (): void {\n this.transformer = new Transformer(this)\n}\n\ninteraction.move = function (data: IMoveEvent): void {\n this.transformer.move(data)\n}\n\ninteraction.zoom = function (data: IZoomEvent): void {\n this.transformer.zoom(data)\n}\n\ninteraction.rotate = function (data: IRotateEvent): void {\n this.transformer.rotate(data)\n}\n\ninteraction.transformEnd = function (): void {\n this.transformer.transformEnd()\n}\n\n\ninteraction.wheel = function (data: IWheelEvent): void {\n const { wheel, pointer } = this.config, { posDeltaSpeed, negDeltaSpeed } = wheel\n if (wheel.disabled) return\n\n if (data.deltaX > 0) posDeltaSpeed && (data.deltaX *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaX *= negDeltaSpeed)\n\n if (data.deltaY > 0) posDeltaSpeed && (data.deltaY *= posDeltaSpeed)\n else negDeltaSpeed && (data.deltaY *= negDeltaSpeed)\n\n const scale = wheel.getScale ? wheel.getScale(data, wheel) : WheelEventHelper.getScale(data, wheel)\n if (scale !== 1) this.zoom(getZoomEventData(scale, data))\n else {\n const move = wheel.getMove ? wheel.getMove(data, wheel) : WheelEventHelper.getMove(data, wheel)\n if (pointer.snap) PointHelper.round(move)\n this.move(getMoveEventData(move, data))\n }\n}\n\n\ninteraction.multiTouch = function (data: IPointerEvent, list: IKeepTouchData[]): void {\n const { disabled, singleGesture } = this.config.multiTouch\n if (disabled) return\n this.pointerWaitCancel()\n\n let gestureData = MultiTouchHelper.getData(list)\n let { moving, zooming, rotating } = this.transformer\n\n if (singleGesture) {\n\n if (!this.transformer.transforming) {\n\n const type = MultiTouchHelper.detect(gestureData, isObject(singleGesture) ? singleGesture : {} as ISingleGestureConfig)\n\n switch (type) {\n case 'move': moving = true; break\n case 'zoom': zooming = true; break\n case 'rotate': rotating = true; break\n default: return\n }\n\n MultiTouchHelper.reset()\n\n }\n\n if (!moving) gestureData.center = MultiTouchHelper.state.center\n\n } else moving = zooming = rotating = true\n\n Object.assign(data, gestureData.center)\n data.multiTouch = true\n\n if (rotating) this.rotate(getRotateEventData(gestureData.rotation, data))\n if (zooming) this.zoom(getZoomEventData(gestureData.scale, data))\n if (moving) this.move(getMoveEventData(gestureData.move, data))\n}","import { IPointerEvent, IFunction, IDragEvent } from '@leafer-ui/interface'\n\nimport { Dragger, BoundsHelper, PointHelper, MoveEvent, isNumber } from '@leafer-ui/core'\n\n\nconst dragger = Dragger.prototype\nconst { abs, min, max, hypot } = Math\n\ndragger.checkDragEndAnimate = function (data: IPointerEvent): boolean | number {\n const { interaction } = this\n const dragAnimate = this.canAnimate && this.moving && interaction.m.dragAnimate\n\n if (dragAnimate) {\n\n const inertia = isNumber(dragAnimate) ? dragAnimate : 0.95\n const stopMove = 0.15\n const maxMove = 150\n\n let moveX = 0, moveY = 0, flickSpeed = 0 // 快速滑动加速\n let totalWeight = 0, weight: number, w = 3, s: number, frame: IDragEvent\n\n const { dragDataList } = this, len = dragDataList.length\n for (let i = len - 1; i >= max(len - 3, 0); i--) {\n frame = dragDataList[i]\n if (frame.time && (Date.now() - frame.time > 100)) break\n weight = w--\n\n moveX += frame.moveX * weight\n moveY += frame.moveY * weight\n totalWeight += weight\n\n s = hypot(frame.moveX, frame.moveY)\n if (s > flickSpeed) flickSpeed = s\n }\n\n if (totalWeight) moveX /= totalWeight, moveY /= totalWeight\n\n if (flickSpeed > 8) {\n const t = min((flickSpeed - 8) / 17, 1)\n const boost = 1.15 + t * (1.6 - 1.15)\n moveX *= boost\n moveY *= boost\n }\n\n const maxAbs = max(abs(moveX), abs(moveY))\n if (maxAbs > maxMove) {\n s = maxMove / maxAbs\n moveX *= s\n moveY *= s\n }\n\n const step = () => {\n moveX *= inertia\n moveY *= inertia\n\n data = { ...data }\n if (abs(moveX) < stopMove && abs(moveY) < stopMove) return this.dragEndReal(data)\n\n PointHelper.move(data, moveX, moveY)\n this.drag(data)\n\n this.animate(step)\n interaction.emit(MoveEvent.DRAG_ANIMATE, data)\n }\n\n this.animate(step)\n }\n\n return dragAnimate\n}\n\ndragger.animate = function (func?: IFunction, off?: 'off'): void { // dragEnd animation\n const animateWait = func || this.animateWait\n if (animateWait) this.interaction.target.nextRender(animateWait, null, off)\n this.animateWait = func\n}\n\ndragger.stopAnimate = function (): void {\n this.animate(null, 'off')\n this.interaction.target.nextRender(() => {\n if (this.dragData) this.dragEndReal(this.dragData)\n })\n}\n\ndragger.checkDragOut = function (data: IPointerEvent): void {\n const { interaction } = this\n this.autoMoveCancel()\n if (this.dragging && !interaction.shrinkCanvasBounds.hitPoint(data)) this.autoMoveOnDragOut(data)\n}\n\ndragger.autoMoveOnDragOut = function (data: IPointerEvent): void {\n const { interaction, downData, canDragOut } = this\n const { autoDistance, dragOut } = interaction.m\n if (!dragOut || !canDragOut || !autoDistance) return\n\n const bounds = interaction.shrinkCanvasBounds\n const { x, y } = bounds\n const right = BoundsHelper.maxX(bounds)\n const bottom = BoundsHelper.maxY(bounds)\n\n const moveX = data.x < x ? autoDistance : (right < data.x ? -autoDistance : 0)\n const moveY = data.y < y ? autoDistance : (bottom < data.y ? -autoDistance : 0)\n let totalX = 0, totalY = 0\n\n this.autoMoveTimer = setInterval(() => {\n totalX += moveX\n totalY += moveY\n\n PointHelper.move(downData, moveX, moveY)\n PointHelper.move(this.dragData, moveX, moveY)\n\n interaction.move({ ...data, moveX, moveY, totalX, totalY, moveType: 'drag' })\n interaction.pointerMoveReal(data)\n }, 10)\n}\n\ndragger.autoMoveCancel = function (): void {\n if (this.autoMoveTimer) {\n clearInterval(this.autoMoveTimer)\n this.autoMoveTimer = 0\n }\n}","export { LeaferTypeCreator } from './LeaferTypeCreator'\nexport { addViewport, addViewportConfig } from './type/viewport'\nexport { MultiTouchHelper } from './interaction/MultiTouchHelper'\nexport { WheelEventHelper } from './interaction/WheelEventHelper'\nexport { Transformer } from './interaction/Transformer'\n\nimport { Plugin } from '@leafer-ui/core'\n\nimport './Leafer'\nimport './interaction/Interaction'\nimport './interaction/Dragger'\n\nPlugin.add('viewport')"],"names":["getScrollType","leafer","scroll","disabled","app","config","move","addViewport","mergeConfig","custom","addViewportConfig","parentApp","isApp","__eventIds","push","on_","MoveEvent","BEFORE_MOVE","e","getValidMove","moveX","moveY","includes","testMove","x","y","maxX","maxY","resistance","moveType","Math","abs","zoomLayer","DRAG_ANIMATE","interaction","stopDragAnimate","END","LeafHelper","animateMove","ZoomEvent","BEFORE_ZOOM","changeScale","getValidScale","scale","scaleOfWorld","viewportConfig","wheel","preventDefault","touch","pointer","preventDefaultMenu","DataHelper","assign","userConfig","debug","Debug","get","LeaferTypeCreator","list","register","name","fn","repeat","run","zoom","min","max","holdSpaceKey","holdMiddleKey","MultiTouchHelper","state","type","typeCount","startTime","totalData","center","getData","a","b","lastCenter","PointHelper","getCenter","from","to","lastDistance","getDistance","rotation","getRotation","getType","data","moveScore","hypot","scaleScore","rotateScore","detect","M","Date","now","add","count","time","reset","sign","within","MathHelper","WheelEventHelper","getMove","event","moveSpeed","deltaX","deltaY","shiftKey","absX","absY","getScale","zoomMode","zoomSpeed","delta","Platform","intWheelDeltaY","ceil","metaKey","ctrlKey","absScale","totalX","totalY","totalScale","totalRotation","Transformer","transforming","this","moving","zooming","rotating","moveData","zoomData","rotateData","constructor","setPath","Object","emit","START","path","MOVE","transformEndWait","ZOOM","rotate","RotateEvent","BEFORE_ROTATE","ROTATE","selector","getByPoint","hitRadius","cancelHover","clearTimeout","transformTimer","setTimeout","transformEnd","p","transformTime","destroy","Leafer","prototype","bounds","Bounds","Point","getMoveEventData","getZoomEventData","initType","checkLimit","set","scrollType","__world","addPoint","DragBoundsHelper","canvas","scaleX","__","InteractionBase","createTransformer","transformer","posDeltaSpeed","negDeltaSpeed","snap","round","multiTouch","singleGesture","pointerWaitCancel","gestureData","isObject","dragger","Dragger","checkDragEndAnimate","dragAnimate","canAnimate","m","inertia","isNumber","stopMove","maxMove","weight","s","frame","flickSpeed","totalWeight","w","dragDataList","len","length","i","boost","maxAbs","step","dragEndReal","drag","animate","func","off","animateWait","target","nextRender","stopAnimate","dragData","checkDragOut","autoMoveCancel","dragging","shrinkCanvasBounds","hitPoint","autoMoveOnDragOut","downData","canDragOut","autoDistance","dragOut","right","BoundsHelper","bottom","autoMoveTimer","setInterval","pointerMoveReal","clearInterval","Plugin"],"mappings":"kFAGM,SAAUA,EAAcC,GAC1B,MAAMC,OAAEA,EAAMC,SAAEA,GAAaF,EAAOG,IAAIC,OAAOC,KAC/C,OAASJ,GAAUC,EAAY,IAAiB,IAAXD,EAAkB,OAASA,CACpE,UCCgBK,EAAYN,EAAqBO,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AS,EAEzBK,KAAK0G,cAAgBC,YAAY,KAC7BjH,GAAUxG,EACVyG,GAAUxG,EAEV2D,EAAAA,YAAY1E,KAAK+N,EAAUjN,EAAOC,GAClC2D,EAAAA,YAAY1E,KAAK4H,KAAK4F,SAAU1M,EAAOC,GAEvCa,EAAY5B,KAAIqI,OAAAvF,OAAAuF,OAAAvF,OAAA,GAAMqC,GAAI,CAAErE,QAAOC,QAAOuG,SAAQC,SAAQhG,SAAU,UACpEK,EAAY4M,gBAAgBrJ,IAC7B,GACP,EAEAqG,EAAQkC,eAAiB,WACjB9F,KAAK0G,gBACLG,cAAc7G,KAAK0G,eACnB1G,KAAK0G,cAAgB,EAE7B,EC7GAI,EAAAA,OAAO9I,IAAI"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-in/viewport",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.3",
|
|
4
4
|
"description": "@leafer-in/viewport",
|
|
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/core": "^1.12.
|
|
38
|
-
"@leafer-ui/interface": "^1.12.
|
|
39
|
-
"@leafer-in/interface": "^1.12.
|
|
37
|
+
"@leafer-ui/core": "^1.12.3",
|
|
38
|
+
"@leafer-ui/interface": "^1.12.3",
|
|
39
|
+
"@leafer-in/interface": "^1.12.3"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/Leafer.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { ILeaferType, IPointData } from '@leafer-ui/interface'
|
|
|
3
3
|
import { Leafer, Bounds, Point, DragBoundsHelper } from '@leafer-ui/core'
|
|
4
4
|
|
|
5
5
|
import { LeaferTypeCreator } from './LeaferTypeCreator'
|
|
6
|
+
import { getScrollType } from './helper'
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
const leafer = Leafer.prototype
|
|
@@ -13,21 +14,21 @@ leafer.initType = function (type: ILeaferType) {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
leafer.getValidMove = function (moveX: number, moveY: number, checkLimit = true): IPointData {
|
|
16
|
-
const {
|
|
17
|
+
const { disabled } = this.app.config.move
|
|
17
18
|
move.set(moveX, moveY)
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const scrollType = getScrollType(this)
|
|
21
|
+
if (scrollType) {
|
|
21
22
|
|
|
22
|
-
if (
|
|
23
|
-
else if (
|
|
23
|
+
if (scrollType.includes('x')) move.y = 0
|
|
24
|
+
else if (scrollType.includes('y')) move.x = 0
|
|
24
25
|
else Math.abs(move.x) > Math.abs(move.y) ? move.y = 0 : move.x = 0
|
|
25
26
|
|
|
26
|
-
if (checkLimit &&
|
|
27
|
+
if (checkLimit && scrollType.includes('limit')) {
|
|
27
28
|
bounds.set(this.__world).addPoint(this.zoomLayer as IPointData)
|
|
28
29
|
DragBoundsHelper.getValidMove(bounds, this.canvas.bounds, 'auto', move, true)
|
|
29
|
-
if (
|
|
30
|
-
else if (
|
|
30
|
+
if (scrollType.includes('x')) move.y = 0
|
|
31
|
+
else if (scrollType.includes('y')) move.x = 0
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
|
package/src/helper.ts
ADDED
package/src/type/viewport.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { ILeaferBase, ILeaferConfig } from '@leafer-ui/interface'
|
|
|
2
2
|
|
|
3
3
|
import { MoveEvent, ZoomEvent, DataHelper, LeafHelper } from '@leafer-ui/core'
|
|
4
4
|
|
|
5
|
+
import { getScrollType } from '../helper'
|
|
6
|
+
|
|
5
7
|
|
|
6
8
|
export function addViewport(leafer: ILeaferBase, mergeConfig?: ILeaferConfig, custom?: boolean): void {
|
|
7
9
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig)
|
|
@@ -10,11 +12,26 @@ export function addViewport(leafer: ILeaferBase, mergeConfig?: ILeaferConfig, cu
|
|
|
10
12
|
leafer.__eventIds.push(
|
|
11
13
|
leafer.on_(MoveEvent.BEFORE_MOVE, (e: MoveEvent) => {
|
|
12
14
|
const move = leafer.getValidMove(e.moveX, e.moveY, false)
|
|
15
|
+
|
|
16
|
+
// check limit
|
|
17
|
+
if (getScrollType(leafer).includes('limit')) {
|
|
18
|
+
const testMove = leafer.getValidMove(0, 0)
|
|
19
|
+
if (testMove.x || testMove.y) {
|
|
20
|
+
const maxX = 100, maxY = 200, resistance = e.moveType === 'drag' ? 0.3 : 0.05
|
|
21
|
+
|
|
22
|
+
if (Math.abs(testMove.x) > maxX) move.x = 0
|
|
23
|
+
else move.x *= resistance
|
|
24
|
+
|
|
25
|
+
if (Math.abs(testMove.y) > maxY) move.y = 0
|
|
26
|
+
else move.y *= resistance
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
13
30
|
leafer.zoomLayer.move(move)
|
|
14
31
|
}),
|
|
15
32
|
leafer.on_(MoveEvent.DRAG_ANIMATE, () => {
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
33
|
+
const testMove = leafer.getValidMove(0, 0)
|
|
34
|
+
if (testMove.x || testMove.y) leafer.interaction.stopDragAnimate()
|
|
18
35
|
}),
|
|
19
36
|
leafer.on_(MoveEvent.END, (e: MoveEvent) => {
|
|
20
37
|
LeafHelper.animateMove(leafer.zoomLayer, leafer.getValidMove(e.moveX, e.moveY))
|