vislite 1.10.0 → 1.11.0-alpha.0
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/CHANGELOG +6 -0
- package/lib/BarLayout/index.es.js +38 -9
- package/lib/BarLayout/index.es.min.js +1 -1
- package/lib/PieLayout/index.es.js +38 -9
- package/lib/PieLayout/index.es.min.js +1 -1
- package/lib/TreeLayout/index.es.js +38 -9
- package/lib/TreeLayout/index.es.min.js +1 -1
- package/lib/animation/index.es.js +38 -9
- package/lib/animation/index.es.min.js +1 -1
- package/lib/index.umd.js +39 -10
- package/lib/index.umd.min.js +2 -2
- package/package.json +3 -3
- package/skills/vislite-lib/BarLayout.md +118 -0
- package/skills/vislite-lib/Canvas.md +184 -0
- package/skills/vislite-lib/Interpolation.md +130 -0
- package/skills/vislite-lib/Matrix.md +175 -0
- package/skills/vislite-lib/PieLayout.md +132 -0
- package/skills/vislite-lib/Projections.md +159 -0
- package/skills/vislite-lib/SKILL.md +176 -0
- package/skills/vislite-lib/SVG.md +138 -0
- package/skills/vislite-lib/TreeLayout.md +177 -0
- package/skills/vislite-lib/Utilities.md +177 -0
- package/skills/vislite-lib/WebGL.md +107 -0
- package/skills/vislite-lib/minialipay/ui-canvas.md +96 -0
- package/skills/vislite-lib/miniprogram/ui-canvas.md +99 -0
- package/skills/vislite-lib/uniapp/ui-canvas.md +114 -0
package/CHANGELOG
CHANGED
|
@@ -171,7 +171,10 @@ function animation(doback, duration, callback) {
|
|
|
171
171
|
let id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
|
|
172
172
|
$timers.push({
|
|
173
173
|
"id": id,
|
|
174
|
-
"createTime": new Date(),
|
|
174
|
+
"createTime": new Date(), // 开始时间
|
|
175
|
+
"pauseTime": -1, // 暂停的时间,继续运行的时候,借助此计算暂停的时间差
|
|
176
|
+
"pauseKeepTime": 0, // 暂停用去的时间
|
|
177
|
+
"status": "running", // running(运行中), paused(暂停中)
|
|
175
178
|
"tick": tick,
|
|
176
179
|
"duration": duration,
|
|
177
180
|
"callback": callback
|
|
@@ -214,15 +217,21 @@ function animation(doback, duration, callback) {
|
|
|
214
217
|
callback = timer.callback;
|
|
215
218
|
|
|
216
219
|
//执行
|
|
217
|
-
passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
|
|
220
|
+
passTime = (+new Date().valueOf() - createTime.valueOf() - timer.pauseKeepTime) / duration;
|
|
218
221
|
passTime = passTime > 1 ? 1 : passTime;
|
|
219
|
-
|
|
220
|
-
if (
|
|
222
|
+
|
|
223
|
+
if (timer.status === "running") {
|
|
224
|
+
tick(passTime);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// 只有当动画没有结束或者动画处于暂停状态时,才继续添加到timers堆栈
|
|
228
|
+
if ((passTime < 1 || timer.status === "paused") && timer.id) {
|
|
221
229
|
//动画没有结束再添加
|
|
222
230
|
$timers.push(timer);
|
|
223
231
|
} else {
|
|
224
232
|
callback(passTime);
|
|
225
233
|
}
|
|
234
|
+
|
|
226
235
|
}
|
|
227
236
|
if ($timers.length <= 0) {
|
|
228
237
|
clock.stop();
|
|
@@ -249,14 +258,34 @@ function animation(doback, duration, callback) {
|
|
|
249
258
|
}, duration, callback);
|
|
250
259
|
|
|
251
260
|
return {
|
|
252
|
-
//
|
|
253
|
-
// 用于在动画结束前结束动画
|
|
261
|
+
// 结束动画
|
|
254
262
|
stop: function () {
|
|
255
|
-
let i
|
|
256
|
-
for (i in $timers) {
|
|
263
|
+
for (let i in $timers) {
|
|
257
264
|
if ($timers[i].id == id) {
|
|
258
265
|
$timers[i].id = void 0;
|
|
259
|
-
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
// 暂停动画
|
|
270
|
+
pause: function () {
|
|
271
|
+
for (let i in $timers) {
|
|
272
|
+
if ($timers[i].id == id) {
|
|
273
|
+
if ($timers[i].pauseTime === -1) {
|
|
274
|
+
$timers[i].pauseTime = new Date();
|
|
275
|
+
$timers[i].status = "paused";
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
// 继续动画
|
|
281
|
+
resume: function () {
|
|
282
|
+
for (let i in $timers) {
|
|
283
|
+
if ($timers[i].id == id) {
|
|
284
|
+
if ($timers[i].pauseTime !== -1) {
|
|
285
|
+
$timers[i].pauseKeepTime += (new Date().valueOf() - $timers[i].pauseTime.valueOf());
|
|
286
|
+
$timers[i].pauseTime = -1;
|
|
287
|
+
$timers[i].status = "running";
|
|
288
|
+
}
|
|
260
289
|
}
|
|
261
290
|
}
|
|
262
291
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,i){for(var a in t)i[a]=t[a];return i}let i,a=[];var e=function(){function e(i){void 0===i&&(i={}),this.name="BarLayout",this.__option={x:50,y:350,width:400,height:300,category:"xAxis",duration:200},this.__config=t(i,{})}return e.prototype.setOption=function(i){return t(i,this.__option),this},e.prototype.use=function(t){var i={coordinate:{x:this.__option.x,y:this.__option.y,width:this.__option.width,height:this.__option.height,xAxis:{type:"xAxis"===this.__option.category?"category":"value",data:[]},yAxis:{type:"xAxis"===this.__option.category?"value":"category",data:[]}},node:[]},a=void 0,e=void 0;if(t.data)for(var n=0,r=t.data;n<r.length;n++){var o=r[n];(void 0===a||o>a)&&(a=o),(void 0===e||o<e)&&(e=o)}else{if(!t.value)throw new Error("No data leads to parsing errors");for(var h=0,
|
|
1
|
+
function t(t,i){for(var a in t)i[a]=t[a];return i}let i,a=[];var e=function(){function e(i){void 0===i&&(i={}),this.name="BarLayout",this.__option={x:50,y:350,width:400,height:300,category:"xAxis",duration:200},this.__config=t(i,{})}return e.prototype.setOption=function(i){return t(i,this.__option),this},e.prototype.use=function(t){var i={coordinate:{x:this.__option.x,y:this.__option.y,width:this.__option.width,height:this.__option.height,xAxis:{type:"xAxis"===this.__option.category?"category":"value",data:[]},yAxis:{type:"xAxis"===this.__option.category?"value":"category",data:[]}},node:[]},a=void 0,e=void 0;if(t.data)for(var n=0,r=t.data;n<r.length;n++){var o=r[n];(void 0===a||o>a)&&(a=o),(void 0===e||o<e)&&(e=o)}else{if(!t.value)throw new Error("No data leads to parsing errors");for(var h=0,s=t.value;h<s.length;h++)for(var u=0,l=s[h].data;u<l.length;u++){o=l[u];(void 0===a||o>a)&&(a=o),(void 0===e||o<e)&&(e=o)}}var _,d,p=function(t,i,a,e){if(t<i){var n=i;i=t,t=n}else if(t==i)return[t];var r=function(t){for(var i=t<100&&t>-100?10:.1,a=-1,e=t;10==i?e>=-100&&e<=100:e<=-100||e>=100;)a+=1,e*=i;if(10==i)return Math.pow(10,a);for(var n="0.",r=1;r<a;r++)n+="0";return+(n+"1")}(t-i),o=Math.ceil((t-i)*r/a),h=function(a){var e=({3:2,4:5,6:5,7:5,8:10,9:10,11:10,12:10,13:15,14:15,16:15,17:15,18:20,19:20,21:20,22:20,23:25,24:25,26:25,27:25}[o+a]||o+a)/r,n=Math.floor(i/e)*e,h=[];h.push(n);for(var s=1;h[h.length-1]<t;s++)h.push(n+e*s);return h},s=h(0),u=function(){for(var t=[],a=s[s.length-1]-(null==e?void 0:e.max),n=0;n<s.length;n++)n+1<s.length&&s[n+1]-a<i||t.push(s[n]-a);return t},l=function(){for(var i=[],a=s[0]-(null==e?void 0:e.min),n=0;n<s.length&&(i[n]=s[n]-a,!(t<=i[n]));n++);return i};if(e){if("max"in e&&"min"in e&&e.max>=t&&e.min<=i){var _=function(){if(s[0]>=e.min&&s[s.length-1]<=e.max)return!0;var t=u();if(t[0]>=e.min&&t[t.length-1]<=e.max)return s=t,!0;var i=l();return i[0]>=e.min&&i[t.length-1]<=e.max?(s=i,!0):void 0};if(_())return s;for(var d=1;d<100;d++){if(s=h(d),_())return s;if(s=h(-d),_())return s}}"max"in e&&e.max>=t?e.max<s[s.length-1]&&(s=u()):"min"in e&&e.min<=i&&e.min>s[0]&&(s=l())}for(var p=0;p<s.length;p++){var f=s[p]+"";/\./.test(f)&&(/9{7,}$/.test(f)?(f=f.replace(/9{7,}$/,""),s[p]=+(f.substring(0,f.length-1)+(+f[f.length-1]+1))):/0{7,}\d$/.test(f)&&(s[p]=+f.replace(/0{7,}\d$/,"")))}return s}(a||0,e||0,5);"xAxis"===this.__option.category?(i.coordinate.xAxis.data=t.category,i.coordinate.yAxis.data=p,_=this.__option.width,d=-1*this.__option.height):(i.coordinate.xAxis.data=p,i.coordinate.yAxis.data=t.category,_=this.__option.height,d=this.__option.width);var f=[],c=_/t.category.length,v=.9*c,g=.05*c;if(t.data)for(var m=0;m<t.data.length;m++)f.push([g+c*m,v]);else{var x=v/t.value.length,y=.9*x,b=.05*x;for(m=0;m<t.value[0].data.length;m++){f[m]=[];for(var w=0;w<t.value.length;w++)f[m].push([g+c*m+x*w+b,y])}}var A=d/(p[p.length-1]-p[0]),k=function(t){return A*(t-p[0])};if("xAxis"===this.__option.category)if(t.data){var T=[];for(m=0;m<t.data.length;m++)T.push({x:this.__option.x+f[m][0],y:this.__option.y,width:f[m][1],height:k(t.data[m]),value:t.data[m]});i.node.push({bar:T})}else for(w=0;w<t.value.length;w++){for(T=[],m=0;m<t.value[w].data.length;m++)T.push({x:this.__option.x+f[m][w][0],y:this.__option.y,width:f[m][w][1],height:k(t.value[w].data[m]),value:t.value[w].data[m]});i.node.push({name:t.value[w].name,bar:T})}else if(t.data){for(T=[],m=0;m<t.data.length;m++)T.push({x:this.__option.x,y:this.__option.y-this.__option.height+f[m][0],width:k(t.data[m]),height:f[m][1],value:t.data[m]});i.node.push({bar:T})}else for(w=0;w<t.value.length;w++){for(T=[],m=0;m<t.value[w].data.length;m++)T.push({x:this.__option.x,y:this.__option.y-this.__option.height+f[m][w][0],width:k(t.value[w].data[m]),height:f[m][w][1],value:t.value[w].data[m]});i.node.push({name:t.value[w].name,bar:T})}return i},e.prototype.bind=function(t,i){return this.__rback=i,this.__oralBar=t,this.__preBar=this.use(this.__oralBar),this.__rback(this.__preBar),this},e.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralBar=null,this.__preBar=null,this},e.prototype.doUpdate=function(){var t=this,e=this.use(this.__oralBar),n=JSON.parse(JSON.stringify(e));return function(t,e,n){arguments.length<2&&(e=400),arguments.length<3&&(n=function(){});let r={timer:function(t,i,e){if(!t)throw new Error("Tick is required!");let n=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return a.push({id:n,createTime:new Date,pauseTime:-1,pauseKeepTime:0,status:"running",tick:t,duration:i,callback:e}),r.start(),n},start:function(){if(!i)try{i=globalThis&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame((function t(){r.tick(),i&&(i=globalThis.requestAnimationFrame(t))})):setInterval(r.tick,13)}catch(t){i=setInterval(r.tick,13)}},tick:function(){let t,i,e,n,o,h,s,u=a;for(a=[],a.length=0,i=0;i<u.length;i++)o=u[i],t=o.createTime,e=o.tick,h=o.duration,n=o.callback,s=(+(new Date).valueOf()-t.valueOf()-o.pauseKeepTime)/h,s=s>1?1:s,"running"===o.status&&e(s),(s<1||"paused"===o.status)&&o.id?a.push(o):n(s);a.length<=0&&r.stop()},stop:function(){if(i){try{globalThis&&globalThis.requestAnimationFrame?globalThis.cancelAnimationFrame(i):clearInterval(i)}catch(t){clearInterval(i)}i=null}}},o=r.timer((function(i){t(i)}),e,n)}((function(i){t.__preBar||t.__rback(n)}),this.__option.duration,(function(){t.__preBar=e,t.__rback(t.__preBar)})),this},e}();export{e as default};
|
|
@@ -41,7 +41,10 @@ function animation(doback, duration, callback) {
|
|
|
41
41
|
let id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
|
|
42
42
|
$timers.push({
|
|
43
43
|
"id": id,
|
|
44
|
-
"createTime": new Date(),
|
|
44
|
+
"createTime": new Date(), // 开始时间
|
|
45
|
+
"pauseTime": -1, // 暂停的时间,继续运行的时候,借助此计算暂停的时间差
|
|
46
|
+
"pauseKeepTime": 0, // 暂停用去的时间
|
|
47
|
+
"status": "running", // running(运行中), paused(暂停中)
|
|
45
48
|
"tick": tick,
|
|
46
49
|
"duration": duration,
|
|
47
50
|
"callback": callback
|
|
@@ -84,15 +87,21 @@ function animation(doback, duration, callback) {
|
|
|
84
87
|
callback = timer.callback;
|
|
85
88
|
|
|
86
89
|
//执行
|
|
87
|
-
passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
|
|
90
|
+
passTime = (+new Date().valueOf() - createTime.valueOf() - timer.pauseKeepTime) / duration;
|
|
88
91
|
passTime = passTime > 1 ? 1 : passTime;
|
|
89
|
-
|
|
90
|
-
if (
|
|
92
|
+
|
|
93
|
+
if (timer.status === "running") {
|
|
94
|
+
tick(passTime);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 只有当动画没有结束或者动画处于暂停状态时,才继续添加到timers堆栈
|
|
98
|
+
if ((passTime < 1 || timer.status === "paused") && timer.id) {
|
|
91
99
|
//动画没有结束再添加
|
|
92
100
|
$timers.push(timer);
|
|
93
101
|
} else {
|
|
94
102
|
callback(passTime);
|
|
95
103
|
}
|
|
104
|
+
|
|
96
105
|
}
|
|
97
106
|
if ($timers.length <= 0) {
|
|
98
107
|
clock.stop();
|
|
@@ -119,14 +128,34 @@ function animation(doback, duration, callback) {
|
|
|
119
128
|
}, duration, callback);
|
|
120
129
|
|
|
121
130
|
return {
|
|
122
|
-
//
|
|
123
|
-
// 用于在动画结束前结束动画
|
|
131
|
+
// 结束动画
|
|
124
132
|
stop: function () {
|
|
125
|
-
let i
|
|
126
|
-
for (i in $timers) {
|
|
133
|
+
for (let i in $timers) {
|
|
127
134
|
if ($timers[i].id == id) {
|
|
128
135
|
$timers[i].id = void 0;
|
|
129
|
-
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
// 暂停动画
|
|
140
|
+
pause: function () {
|
|
141
|
+
for (let i in $timers) {
|
|
142
|
+
if ($timers[i].id == id) {
|
|
143
|
+
if ($timers[i].pauseTime === -1) {
|
|
144
|
+
$timers[i].pauseTime = new Date();
|
|
145
|
+
$timers[i].status = "paused";
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
// 继续动画
|
|
151
|
+
resume: function () {
|
|
152
|
+
for (let i in $timers) {
|
|
153
|
+
if ($timers[i].id == id) {
|
|
154
|
+
if ($timers[i].pauseTime !== -1) {
|
|
155
|
+
$timers[i].pauseKeepTime += (new Date().valueOf() - $timers[i].pauseTime.valueOf());
|
|
156
|
+
$timers[i].pauseTime = -1;
|
|
157
|
+
$timers[i].status = "running";
|
|
158
|
+
}
|
|
130
159
|
}
|
|
131
160
|
}
|
|
132
161
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,i){for(var e in t)i[e]=t[e];return i}function i(t,i,e,n,r){var o=Math.cos(e),a=Math.sin(e);return[(n-t)*o-(r-i)*a+t,(n-t)*a+(r-i)*o+i]}let e,n=[];var r=function(){function r(i){void 0===i&&(i={}),this.name="PieLayout",this.__option={cx:200,cy:200,radius:[50,100],duration:200},this.__hoverIndex=-1,this.__config=t(i,{name:function(t,i){return t.name},value:function(t,i){return t.value}})}return r.prototype.setOption=function(i){return t(i,this.__option),this},r.prototype.use=function(t,e){void 0===e&&(e=-1);for(var n={count:t.length,cx:this.__option.cx,cy:this.__option.cy,radius:this.__option.radius,hoverIndex:e,node:[]},r=0,o=[],a=[],s=0;s<t.length;s++)o[s]=this.__config.name(t[s],t),a[s]=this.__config.value(t[s],t),r+=a[s];var u,_=-.5*Math.PI;for(s=0;s<t.length;s++){u=a[s]/r*Math.PI*2;var h=[this.__option.radius[0]*(1+(this.__option.radius[0]>0&&e===s?-.1:0)),this.__option.radius[1]*(1+(e===s?.05:0))],c=_+.5*u,l=Math.max(this.__option.radius[0],this.__option.radius[1]),d=i(n.cx,n.cy,c,n.cx+l,n.cy),p=i(n.cx,n.cy,c,n.cx+l+15,n.cy),f=d[0]>n.cx?1:-1,v=[p[0]+20*f,p[1]],g=[p[0]+25*f,p[1]];n.node[s]={value:a[s],name:o[s],beginDeg:_,deg:u,isHover:e===s,radius:h,label:{line:[d,p,v],position:g,align:-1===f?"right":"left"}},_+=u}return n},r.prototype.bind=function(t,i){return this.__rback=i,this.__oralPie=t,this.__prePie=this.use(this.__oralPie,this.__hoverIndex),this.__rback(this.__prePie),this},r.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralPie=null,this.__prePie=null,this.__hoverIndex=-1,this},r.prototype.setHover=function(t){return this.__prePie&&this.__hoverIndex!==t?(this.__hoverIndex=t,this.doUpdate(),this):this},r.prototype.doUpdate=function(){var t=this,i=this.use(this.__oralPie,this.__hoverIndex),r=JSON.parse(JSON.stringify(i));return function(t,i,r){arguments.length<2&&(i=400),arguments.length<3&&(r=function(){});let o={timer:function(t,i,e){if(!t)throw new Error("Tick is required!");let r=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return n.push({id:r,createTime:new Date,tick:t,duration:i,callback:e}),o.start(),r},start:function(){if(!e)try{e=globalThis&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame((function t(){o.tick(),e&&(e=globalThis.requestAnimationFrame(t))})):setInterval(o.tick,13)}catch(t){e=setInterval(o.tick,13)}},tick:function(){let t,i,e,r,a,s,u,_=n;for(n=[],n.length=0,i=0;i<_.length;i++)a=_[i],t=a.createTime,e=a.tick,s=a.duration,r=a.callback,u=(+(new Date).valueOf()-t.valueOf())/s,u=u>1?1:u,e(u),u<1&&a.id?n.push(a):r(u);n.length<=0&&o.stop()},stop:function(){if(e){try{globalThis&&globalThis.requestAnimationFrame?globalThis.cancelAnimationFrame(e):clearInterval(e)}catch(t){clearInterval(e)}e=null}}},a=o.timer((function(i){t(i)}),i,r)}((function(e){if(t.__prePie)for(var n=0;n<r.count;n++)r.node[n].radius[0]=t.__prePie.node[n].radius[0]+(i.node[n].radius[0]-t.__prePie.node[n].radius[0])*e,r.node[n].radius[1]=t.__prePie.node[n].radius[1]+(i.node[n].radius[1]-t.__prePie.node[n].radius[1])*e;t.__rback(r)}),this.__option.duration,(function(){t.__prePie=i,t.__rback(t.__prePie)})),this},r}();export{r as default};
|
|
1
|
+
function t(t,i){for(var e in t)i[e]=t[e];return i}function i(t,i,e,n,r){var o=Math.cos(e),a=Math.sin(e);return[(n-t)*o-(r-i)*a+t,(n-t)*a+(r-i)*o+i]}let e,n=[];var r=function(){function r(i){void 0===i&&(i={}),this.name="PieLayout",this.__option={cx:200,cy:200,radius:[50,100],duration:200},this.__hoverIndex=-1,this.__config=t(i,{name:function(t,i){return t.name},value:function(t,i){return t.value}})}return r.prototype.setOption=function(i){return t(i,this.__option),this},r.prototype.use=function(t,e){void 0===e&&(e=-1);for(var n={count:t.length,cx:this.__option.cx,cy:this.__option.cy,radius:this.__option.radius,hoverIndex:e,node:[]},r=0,o=[],a=[],s=0;s<t.length;s++)o[s]=this.__config.name(t[s],t),a[s]=this.__config.value(t[s],t),r+=a[s];var u,_=-.5*Math.PI;for(s=0;s<t.length;s++){u=a[s]/r*Math.PI*2;var h=[this.__option.radius[0]*(1+(this.__option.radius[0]>0&&e===s?-.1:0)),this.__option.radius[1]*(1+(e===s?.05:0))],c=_+.5*u,l=Math.max(this.__option.radius[0],this.__option.radius[1]),d=i(n.cx,n.cy,c,n.cx+l,n.cy),p=i(n.cx,n.cy,c,n.cx+l+15,n.cy),f=d[0]>n.cx?1:-1,v=[p[0]+20*f,p[1]],g=[p[0]+25*f,p[1]];n.node[s]={value:a[s],name:o[s],beginDeg:_,deg:u,isHover:e===s,radius:h,label:{line:[d,p,v],position:g,align:-1===f?"right":"left"}},_+=u}return n},r.prototype.bind=function(t,i){return this.__rback=i,this.__oralPie=t,this.__prePie=this.use(this.__oralPie,this.__hoverIndex),this.__rback(this.__prePie),this},r.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralPie=null,this.__prePie=null,this.__hoverIndex=-1,this},r.prototype.setHover=function(t){return this.__prePie&&this.__hoverIndex!==t?(this.__hoverIndex=t,this.doUpdate(),this):this},r.prototype.doUpdate=function(){var t=this,i=this.use(this.__oralPie,this.__hoverIndex),r=JSON.parse(JSON.stringify(i));return function(t,i,r){arguments.length<2&&(i=400),arguments.length<3&&(r=function(){});let o={timer:function(t,i,e){if(!t)throw new Error("Tick is required!");let r=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return n.push({id:r,createTime:new Date,pauseTime:-1,pauseKeepTime:0,status:"running",tick:t,duration:i,callback:e}),o.start(),r},start:function(){if(!e)try{e=globalThis&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame((function t(){o.tick(),e&&(e=globalThis.requestAnimationFrame(t))})):setInterval(o.tick,13)}catch(t){e=setInterval(o.tick,13)}},tick:function(){let t,i,e,r,a,s,u,_=n;for(n=[],n.length=0,i=0;i<_.length;i++)a=_[i],t=a.createTime,e=a.tick,s=a.duration,r=a.callback,u=(+(new Date).valueOf()-t.valueOf()-a.pauseKeepTime)/s,u=u>1?1:u,"running"===a.status&&e(u),(u<1||"paused"===a.status)&&a.id?n.push(a):r(u);n.length<=0&&o.stop()},stop:function(){if(e){try{globalThis&&globalThis.requestAnimationFrame?globalThis.cancelAnimationFrame(e):clearInterval(e)}catch(t){clearInterval(e)}e=null}}},a=o.timer((function(i){t(i)}),i,r)}((function(e){if(t.__prePie)for(var n=0;n<r.count;n++)r.node[n].radius[0]=t.__prePie.node[n].radius[0]+(i.node[n].radius[0]-t.__prePie.node[n].radius[0])*e,r.node[n].radius[1]=t.__prePie.node[n].radius[1]+(i.node[n].radius[1]-t.__prePie.node[n].radius[1])*e;t.__rback(r)}),this.__option.duration,(function(){t.__prePie=i,t.__rback(t.__prePie)})),this},r}();export{r as default};
|
|
@@ -211,7 +211,10 @@ function animation(doback, duration, callback) {
|
|
|
211
211
|
let id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
|
|
212
212
|
$timers.push({
|
|
213
213
|
"id": id,
|
|
214
|
-
"createTime": new Date(),
|
|
214
|
+
"createTime": new Date(), // 开始时间
|
|
215
|
+
"pauseTime": -1, // 暂停的时间,继续运行的时候,借助此计算暂停的时间差
|
|
216
|
+
"pauseKeepTime": 0, // 暂停用去的时间
|
|
217
|
+
"status": "running", // running(运行中), paused(暂停中)
|
|
215
218
|
"tick": tick,
|
|
216
219
|
"duration": duration,
|
|
217
220
|
"callback": callback
|
|
@@ -254,15 +257,21 @@ function animation(doback, duration, callback) {
|
|
|
254
257
|
callback = timer.callback;
|
|
255
258
|
|
|
256
259
|
//执行
|
|
257
|
-
passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
|
|
260
|
+
passTime = (+new Date().valueOf() - createTime.valueOf() - timer.pauseKeepTime) / duration;
|
|
258
261
|
passTime = passTime > 1 ? 1 : passTime;
|
|
259
|
-
|
|
260
|
-
if (
|
|
262
|
+
|
|
263
|
+
if (timer.status === "running") {
|
|
264
|
+
tick(passTime);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// 只有当动画没有结束或者动画处于暂停状态时,才继续添加到timers堆栈
|
|
268
|
+
if ((passTime < 1 || timer.status === "paused") && timer.id) {
|
|
261
269
|
//动画没有结束再添加
|
|
262
270
|
$timers.push(timer);
|
|
263
271
|
} else {
|
|
264
272
|
callback(passTime);
|
|
265
273
|
}
|
|
274
|
+
|
|
266
275
|
}
|
|
267
276
|
if ($timers.length <= 0) {
|
|
268
277
|
clock.stop();
|
|
@@ -289,14 +298,34 @@ function animation(doback, duration, callback) {
|
|
|
289
298
|
}, duration, callback);
|
|
290
299
|
|
|
291
300
|
return {
|
|
292
|
-
//
|
|
293
|
-
// 用于在动画结束前结束动画
|
|
301
|
+
// 结束动画
|
|
294
302
|
stop: function () {
|
|
295
|
-
let i
|
|
296
|
-
for (i in $timers) {
|
|
303
|
+
for (let i in $timers) {
|
|
297
304
|
if ($timers[i].id == id) {
|
|
298
305
|
$timers[i].id = void 0;
|
|
299
|
-
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
// 暂停动画
|
|
310
|
+
pause: function () {
|
|
311
|
+
for (let i in $timers) {
|
|
312
|
+
if ($timers[i].id == id) {
|
|
313
|
+
if ($timers[i].pauseTime === -1) {
|
|
314
|
+
$timers[i].pauseTime = new Date();
|
|
315
|
+
$timers[i].status = "paused";
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
// 继续动画
|
|
321
|
+
resume: function () {
|
|
322
|
+
for (let i in $timers) {
|
|
323
|
+
if ($timers[i].id == id) {
|
|
324
|
+
if ($timers[i].pauseTime !== -1) {
|
|
325
|
+
$timers[i].pauseKeepTime += (new Date().valueOf() - $timers[i].pauseTime.valueOf());
|
|
326
|
+
$timers[i].pauseTime = -1;
|
|
327
|
+
$timers[i].status = "running";
|
|
328
|
+
}
|
|
300
329
|
}
|
|
301
330
|
}
|
|
302
331
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=function(e,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},t(e,o)};"function"==typeof SuppressedError&&SuppressedError;function e(t,e){for(var o in t)e[o]=t[o];return e}var o=function(){function t(t){void 0===t&&(t={}),this.name="Tree",this.__config=e(t,{root:function(t){return t},children:function(t){return t.children},id:function(t){return t.name}})}return t.prototype.use=function(t,e){return void 0===e&&(e={}),function(t,e,o){void 0===o&&(o={});var n=function(t,e){var o,n,i={},r=e.root(t);o=n=e.id(r),i[o]={data:r,pid:null,id:o,isOpen:!0,show:!0,deg:0,children:[]};var
|
|
1
|
+
var t=function(e,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},t(e,o)};"function"==typeof SuppressedError&&SuppressedError;function e(t,e){for(var o in t)e[o]=t[o];return e}var o=function(){function t(t){void 0===t&&(t={}),this.name="Tree",this.__config=e(t,{root:function(t){return t},children:function(t){return t.children},id:function(t){return t.name}})}return t.prototype.use=function(t,e){return void 0===e&&(e={}),function(t,e,o){void 0===o&&(o={});var n=function(t,e){var o,n,i={},r=e.root(t);o=n=e.id(r),i[o]={data:r,pid:null,id:o,isOpen:!0,show:!0,deg:0,children:[]};var s=1;return function n(r,p){var h=e.children(r,t);s+=h?h.length:0;for(var d=0;h&&d<h.length;d++)o=e.id(h[d]),i[p].children.push(o),i[o]={data:h[d],pid:p,id:o,isOpen:!0,show:!0,deg:0,children:[]},n(h[d],o)}(r,o),{rid:n,value:i,num:s}}(t,e),i=n.value,r=n.rid;if(1==n.num)return i[r].left=.5,i[r].top=.5,i[r].show=!0,{deep:1,node:i,root:r,size:1};var s=[],p=0,h=0;for(var d in o[r]?(i[r].left=.5,i[r].top=.5,i[r].show=!0,p=1):function t(e,n){n>h&&(h=n);var r=0;if(!o[e.id])for(r=0;r<e.children.length;r++)t(i[e.children[r]],n+1);if(i[e.id].left=n+.5,0==r?(null==s[n]&&(s[n]=-.5),null==s[n-1]&&(s[n-1]=-.5),i[e.id].top=s[n]+1,s[n]+1+.5*(i[e.pid].children.length-1)-1<s[n-1]&&(i[e.id].top=s[n-1]+1-.5*(i[e.pid].children.length-1))):i[e.id].top=.5*(i[e.children[0]].top+i[e.children[r-1]].top),i[e.id].top<=s[n])var d=s[n]+1-i[e.id].top((function t(e,o){i[e].top+=d,s[o]<i[e].top&&(s[o]=i[e].top);for(var n=0;n<i[e].children.length;n++)t(i[e].children[n],o+1)}))(e.id,n);s[n]=i[e.id].top,i[e.id].top+.5>p&&(p=i[e.id].top+.5)}(i[r],0),o)o[d]&&(i[d].isOpen=!1,function t(e,o,n){for(var r=0;r<i[e].children.length;r++)i[i[e].children[r]].left=o,i[i[e].children[r]].top=n,i[i[e].children[r]].show=!1,t(i[e].children[r],o,n)}(d,i[d].left,i[d].top));return{node:i,root:r,size:p,deep:h+1}}(t,this.__config,e)},t}();let n,i=[];function r(t,e,o,n,i){var r=Math.cos(o),s=Math.sin(o);return[(n-t)*r-(i-e)*s+t,(n-t)*s+(i-e)*r+e]}var s=function(o){function s(){var t=null!==o&&o.apply(this,arguments)||this;return t.name="TreeLayout",t.__option={offsetX:0,offsetY:0,duration:500,type:"plain",direction:"LR",x:100,y:100,width:100,height:100,radius:100},t.__noOpens={},t}return function(e,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}(s,o),s.prototype.setOption=function(t){return e(t,this.__option),this},s.prototype.use=function(t,e){void 0===e&&(e={});var n=o.prototype.use.call(this,t,e);if(0!=this.__option.offsetX||0!=this.__option.offsetY)for(var i in n.node)if(!n.node[i].show){var s=0,p=i;do{p=n.node[p].pid,s++}while(!n.node[p].show);n.node[i].left+=this.__option.offsetX*s,n.node[i].top+=this.__option.offsetY*s}if("rect"==this.__option.type){if("LR"==this.__option.direction||"RL"==this.__option.direction){var h=this.__option.height/n.size,d=this.__option.width/(n.deep-1),_=this.__option.y-.5*this.__option.height,l="LR"==this.__option.direction?1:-1;for(var i in n.node)1==n.deep?(n.node[i].left=this.__option.x+.5*this.__option.width*l,n.node[i].top=this.__option.y):(n.node[i].left=this.__option.x+(n.node[i].left-.5)*d*l,n.node[i].top=n.node[i].top*h+_)}else if("TB"==this.__option.direction||"BT"==this.__option.direction){h=this.__option.width/n.size,d=this.__option.height/(n.deep-1),_=this.__option.x-.5*this.__option.width,l="TB"==this.__option.direction?1:-1;for(var i in n.node)if(n.node[i].deg="TB"==this.__option.direction?.5*Math.PI:-.5*Math.PI,1==n.deep)n.node[i].left=this.__option.x,n.node[i].top=this.__option.y+.5*this.__option.height*l;else{var a=n.node[i].left;n.node[i].left=n.node[i].top*h+_,n.node[i].top=this.__option.y+(a-.5)*d*l}}}else if("circle"==this.__option.type){var u=this.__option.x,f=this.__option.y,c=2*Math.PI/n.size,v=this.__option.radius/(n.deep-1);for(var i in n.node)if(.5==n.node[i].left)n.node[i].left=u,n.node[i].top=f;else{var T=r(u,f,c*n.node[i].top,u+(n.node[i].left-.5)*v,f);n.node[i].deg=c*n.node[i].top,n.node[i].left=T[0],n.node[i].top=T[1]}}return n},s.prototype.bind=function(t,e,o){return void 0===o&&(o={}),this.__rback=e,this.__oralTree=t,this.__noOpens=o,this.__preTree=this.use(this.__oralTree,this.__noOpens),this.__rback(this.__preTree),this},s.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralTree=null,this.__preTree=null,this.__noOpens={},this},s.prototype.doUpdate=function(){var t=this,e=this.use(this.__oralTree,this.__noOpens),o=JSON.parse(JSON.stringify(e));return function(t,e,o){arguments.length<2&&(e=400),arguments.length<3&&(o=function(){});let r={timer:function(t,e,o){if(!t)throw new Error("Tick is required!");let n=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return i.push({id:n,createTime:new Date,pauseTime:-1,pauseKeepTime:0,status:"running",tick:t,duration:e,callback:o}),r.start(),n},start:function(){if(!n)try{n=globalThis&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame((function t(){r.tick(),n&&(n=globalThis.requestAnimationFrame(t))})):setInterval(r.tick,13)}catch(t){n=setInterval(r.tick,13)}},tick:function(){let t,e,o,n,s,p,h,d=i;for(i=[],i.length=0,e=0;e<d.length;e++)s=d[e],t=s.createTime,o=s.tick,p=s.duration,n=s.callback,h=(+(new Date).valueOf()-t.valueOf()-s.pauseKeepTime)/p,h=h>1?1:h,"running"===s.status&&o(h),(h<1||"paused"===s.status)&&s.id?i.push(s):n(h);i.length<=0&&r.stop()},stop:function(){if(n){try{globalThis&&globalThis.requestAnimationFrame?globalThis.cancelAnimationFrame(n):clearInterval(n)}catch(t){clearInterval(n)}n=null}}},s=r.timer((function(e){t(e)}),e,o)}((function(n){if(t.__preTree)for(var i in o.node)(e.node[i].show||t.__preTree.node[i].show)&&(o.node[i].show=!0,o.node[i].left=t.__preTree.node[i].left+(e.node[i].left-t.__preTree.node[i].left)*n,o.node[i].top=t.__preTree.node[i].top+(e.node[i].top-t.__preTree.node[i].top)*n);t.__rback(o)}),this.__option.duration,(function(){t.__preTree=e,t.__rback(t.__preTree)})),this},s.prototype.closeNode=function(t){return this.__preTree?(this.__noOpens[t]=!0,this.doUpdate(),this):this},s.prototype.openNode=function(t){return this.__preTree?(this.__noOpens[t]=!1,this.doUpdate(),this):this},s.prototype.toggleNode=function(t){return this.__preTree?(this.__noOpens[t]=!this.__noOpens[t],this.doUpdate(),this):this},s}(o);export{s as default};
|
|
@@ -26,7 +26,10 @@ function animation(doback, duration, callback) {
|
|
|
26
26
|
let id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
|
|
27
27
|
$timers.push({
|
|
28
28
|
"id": id,
|
|
29
|
-
"createTime": new Date(),
|
|
29
|
+
"createTime": new Date(), // 开始时间
|
|
30
|
+
"pauseTime": -1, // 暂停的时间,继续运行的时候,借助此计算暂停的时间差
|
|
31
|
+
"pauseKeepTime": 0, // 暂停用去的时间
|
|
32
|
+
"status": "running", // running(运行中), paused(暂停中)
|
|
30
33
|
"tick": tick,
|
|
31
34
|
"duration": duration,
|
|
32
35
|
"callback": callback
|
|
@@ -69,15 +72,21 @@ function animation(doback, duration, callback) {
|
|
|
69
72
|
callback = timer.callback;
|
|
70
73
|
|
|
71
74
|
//执行
|
|
72
|
-
passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
|
|
75
|
+
passTime = (+new Date().valueOf() - createTime.valueOf() - timer.pauseKeepTime) / duration;
|
|
73
76
|
passTime = passTime > 1 ? 1 : passTime;
|
|
74
|
-
|
|
75
|
-
if (
|
|
77
|
+
|
|
78
|
+
if (timer.status === "running") {
|
|
79
|
+
tick(passTime);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// 只有当动画没有结束或者动画处于暂停状态时,才继续添加到timers堆栈
|
|
83
|
+
if ((passTime < 1 || timer.status === "paused") && timer.id) {
|
|
76
84
|
//动画没有结束再添加
|
|
77
85
|
$timers.push(timer);
|
|
78
86
|
} else {
|
|
79
87
|
callback(passTime);
|
|
80
88
|
}
|
|
89
|
+
|
|
81
90
|
}
|
|
82
91
|
if ($timers.length <= 0) {
|
|
83
92
|
clock.stop();
|
|
@@ -104,14 +113,34 @@ function animation(doback, duration, callback) {
|
|
|
104
113
|
}, duration, callback);
|
|
105
114
|
|
|
106
115
|
return {
|
|
107
|
-
//
|
|
108
|
-
// 用于在动画结束前结束动画
|
|
116
|
+
// 结束动画
|
|
109
117
|
stop: function () {
|
|
110
|
-
let i
|
|
111
|
-
for (i in $timers) {
|
|
118
|
+
for (let i in $timers) {
|
|
112
119
|
if ($timers[i].id == id) {
|
|
113
120
|
$timers[i].id = void 0;
|
|
114
|
-
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
// 暂停动画
|
|
125
|
+
pause: function () {
|
|
126
|
+
for (let i in $timers) {
|
|
127
|
+
if ($timers[i].id == id) {
|
|
128
|
+
if ($timers[i].pauseTime === -1) {
|
|
129
|
+
$timers[i].pauseTime = new Date();
|
|
130
|
+
$timers[i].status = "paused";
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
// 继续动画
|
|
136
|
+
resume: function () {
|
|
137
|
+
for (let i in $timers) {
|
|
138
|
+
if ($timers[i].id == id) {
|
|
139
|
+
if ($timers[i].pauseTime !== -1) {
|
|
140
|
+
$timers[i].pauseKeepTime += (new Date().valueOf() - $timers[i].pauseTime.valueOf());
|
|
141
|
+
$timers[i].pauseTime = -1;
|
|
142
|
+
$timers[i].status = "running";
|
|
143
|
+
}
|
|
115
144
|
}
|
|
116
145
|
}
|
|
117
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let t
|
|
1
|
+
let e,t=[],i=13;function n(n,a,u){return function(n,a,u){arguments.length<2&&(a=400),arguments.length<3&&(u=function(){});let r={timer:function(e,i,n){if(!e)throw new Error("Tick is required!");let a=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return t.push({id:a,createTime:new Date,pauseTime:-1,pauseKeepTime:0,status:"running",tick:e,duration:i,callback:n}),r.start(),a},start:function(){if(!e)try{e=globalThis&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame((function t(){r.tick(),e&&(e=globalThis.requestAnimationFrame(t))})):setInterval(r.tick,i)}catch(t){e=setInterval(r.tick,i)}},tick:function(){let e,i,n,a,u,s,l,o=t;for(t=[],t.length=0,i=0;i<o.length;i++)u=o[i],e=u.createTime,n=u.tick,s=u.duration,a=u.callback,l=(+(new Date).valueOf()-e.valueOf()-u.pauseKeepTime)/s,l=l>1?1:l,"running"===u.status&&n(l),(l<1||"paused"===u.status)&&u.id?t.push(u):a(l);t.length<=0&&r.stop()},stop:function(){if(e){try{globalThis&&globalThis.requestAnimationFrame?globalThis.cancelAnimationFrame(e):clearInterval(e)}catch(t){clearInterval(e)}e=null}}},s=r.timer((function(e){n(e)}),a,u);return{stop:function(){for(let e in t)t[e].id==s&&(t[e].id=void 0)},pause:function(){for(let e in t)t[e].id==s&&-1===t[e].pauseTime&&(t[e].pauseTime=new Date,t[e].status="paused")},resume:function(){for(let e in t)t[e].id==s&&-1!==t[e].pauseTime&&(t[e].pauseKeepTime+=(new Date).valueOf()-t[e].pauseTime.valueOf(),t[e].pauseTime=-1,t[e].status="running")}}}(n,a||400,u||function(){}).stop}export{n as default};
|
package/lib/index.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v1.
|
|
2
|
+
* VISLite JavaScript Library v1.11.0-alpha.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -321,7 +321,10 @@
|
|
|
321
321
|
let id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
|
|
322
322
|
$timers.push({
|
|
323
323
|
"id": id,
|
|
324
|
-
"createTime": new Date(),
|
|
324
|
+
"createTime": new Date(), // 开始时间
|
|
325
|
+
"pauseTime": -1, // 暂停的时间,继续运行的时候,借助此计算暂停的时间差
|
|
326
|
+
"pauseKeepTime": 0, // 暂停用去的时间
|
|
327
|
+
"status": "running", // running(运行中), paused(暂停中)
|
|
325
328
|
"tick": tick,
|
|
326
329
|
"duration": duration,
|
|
327
330
|
"callback": callback
|
|
@@ -364,15 +367,21 @@
|
|
|
364
367
|
callback = timer.callback;
|
|
365
368
|
|
|
366
369
|
//执行
|
|
367
|
-
passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
|
|
370
|
+
passTime = (+new Date().valueOf() - createTime.valueOf() - timer.pauseKeepTime) / duration;
|
|
368
371
|
passTime = passTime > 1 ? 1 : passTime;
|
|
369
|
-
|
|
370
|
-
if (
|
|
372
|
+
|
|
373
|
+
if (timer.status === "running") {
|
|
374
|
+
tick(passTime);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// 只有当动画没有结束或者动画处于暂停状态时,才继续添加到timers堆栈
|
|
378
|
+
if ((passTime < 1 || timer.status === "paused") && timer.id) {
|
|
371
379
|
//动画没有结束再添加
|
|
372
380
|
$timers.push(timer);
|
|
373
381
|
} else {
|
|
374
382
|
callback(passTime);
|
|
375
383
|
}
|
|
384
|
+
|
|
376
385
|
}
|
|
377
386
|
if ($timers.length <= 0) {
|
|
378
387
|
clock.stop();
|
|
@@ -399,14 +408,34 @@
|
|
|
399
408
|
}, duration, callback);
|
|
400
409
|
|
|
401
410
|
return {
|
|
402
|
-
//
|
|
403
|
-
// 用于在动画结束前结束动画
|
|
411
|
+
// 结束动画
|
|
404
412
|
stop: function () {
|
|
405
|
-
let i
|
|
406
|
-
for (i in $timers) {
|
|
413
|
+
for (let i in $timers) {
|
|
407
414
|
if ($timers[i].id == id) {
|
|
408
415
|
$timers[i].id = void 0;
|
|
409
|
-
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
// 暂停动画
|
|
420
|
+
pause: function () {
|
|
421
|
+
for (let i in $timers) {
|
|
422
|
+
if ($timers[i].id == id) {
|
|
423
|
+
if ($timers[i].pauseTime === -1) {
|
|
424
|
+
$timers[i].pauseTime = new Date();
|
|
425
|
+
$timers[i].status = "paused";
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
// 继续动画
|
|
431
|
+
resume: function () {
|
|
432
|
+
for (let i in $timers) {
|
|
433
|
+
if ($timers[i].id == id) {
|
|
434
|
+
if ($timers[i].pauseTime !== -1) {
|
|
435
|
+
$timers[i].pauseKeepTime += (new Date().valueOf() - $timers[i].pauseTime.valueOf());
|
|
436
|
+
$timers[i].pauseTime = -1;
|
|
437
|
+
$timers[i].status = "running";
|
|
438
|
+
}
|
|
410
439
|
}
|
|
411
440
|
}
|
|
412
441
|
}
|