vislite 1.3.0 → 1.4.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/AUTHORS.txt +6 -6
- package/CHANGELOG +12 -5
- package/LICENSE +20 -20
- package/README.md +284 -284
- package/lib/BarLayout/index.es.d.ts +3 -0
- package/lib/BarLayout/index.es.js +467 -0
- package/lib/BarLayout/index.es.min.d.ts +3 -0
- package/lib/BarLayout/index.es.min.js +10 -0
- package/lib/Buffer/index.es.js +1 -1
- package/lib/Buffer/index.es.min.js +1 -1
- package/lib/Canvas/index.es.js +2 -2
- package/lib/Canvas/index.es.min.js +1 -1
- package/lib/Cardinal/index.es.js +1 -1
- package/lib/Cardinal/index.es.min.js +1 -1
- package/lib/Eoap/index.es.js +1 -1
- package/lib/Eoap/index.es.min.js +1 -1
- package/lib/Hermite/index.es.js +1 -1
- package/lib/Hermite/index.es.min.js +1 -1
- package/lib/MapCoordinate/index.es.js +1 -1
- package/lib/MapCoordinate/index.es.min.js +1 -1
- package/lib/Matrix4/index.es.js +1 -1
- package/lib/Matrix4/index.es.min.js +1 -1
- package/lib/Mercator/index.es.js +1 -1
- package/lib/Mercator/index.es.min.js +1 -1
- package/lib/PieLayout/index.es.d.ts +3 -0
- package/lib/PieLayout/index.es.js +234 -0
- package/lib/PieLayout/index.es.min.d.ts +3 -0
- package/lib/PieLayout/index.es.min.js +9 -0
- package/lib/RawCanvas/index.es.js +2 -2
- package/lib/RawCanvas/index.es.min.js +1 -1
- package/lib/SVG/index.es.js +29 -6
- package/lib/SVG/index.es.min.js +2 -2
- package/lib/Shader/index.es.js +1 -1
- package/lib/Shader/index.es.min.js +1 -1
- package/lib/Texture/index.es.js +1 -1
- package/lib/Texture/index.es.min.js +1 -1
- package/lib/TreeLayout/index.es.js +109 -102
- package/lib/TreeLayout/index.es.min.js +6 -2
- package/lib/animation/index.es.js +114 -103
- package/lib/animation/index.es.min.js +6 -2
- package/lib/assemble/index.es.js +1 -1
- package/lib/assemble/index.es.min.js +1 -1
- package/lib/getLoopColors/index.es.js +1 -1
- package/lib/getLoopColors/index.es.min.js +1 -1
- package/lib/getWebGLContext/index.es.js +1 -1
- package/lib/getWebGLContext/index.es.min.js +1 -1
- package/lib/index.umd.js +510 -158
- package/lib/index.umd.min.js +12 -2
- package/lib/initOption/index.es.js +1 -1
- package/lib/initOption/index.es.min.js +1 -1
- package/lib/mergeOption/index.es.js +1 -1
- package/lib/mergeOption/index.es.min.js +1 -1
- package/lib/move/index.es.js +1 -1
- package/lib/move/index.es.min.js +1 -1
- package/lib/rotate/index.es.js +1 -1
- package/lib/rotate/index.es.min.js +1 -1
- package/lib/ruler/index.es.js +1 -1
- package/lib/ruler/index.es.min.js +1 -1
- package/lib/scale/index.es.js +1 -1
- package/lib/scale/index.es.min.js +1 -1
- package/lib/throttle/index.es.js +55 -50
- package/lib/throttle/index.es.min.js +5 -1
- package/minialipay/ui-canvas/drawImage.js +35 -35
- package/minialipay/ui-canvas/index.acss +4 -4
- package/minialipay/ui-canvas/index.axml +3 -3
- package/minialipay/ui-canvas/index.d.ts +1 -1
- package/minialipay/ui-canvas/index.js +100 -100
- package/minialipay/ui-canvas/index.json +6 -6
- package/miniprogram/ui-canvas/drawImage.js +35 -35
- package/miniprogram/ui-canvas/index.js +117 -117
- package/miniprogram/ui-canvas/index.json +4 -4
- package/miniprogram/ui-canvas/index.wxml +4 -4
- package/miniprogram/ui-canvas/index.wxss +5 -5
- package/package/BarLayout/index.ts +3 -0
- package/package/Buffer/index.ts +2 -2
- package/package/Canvas/index.ts +2 -2
- package/package/Cardinal/index.ts +2 -2
- package/package/Eoap/index.ts +2 -2
- package/package/Hermite/index.ts +2 -2
- package/package/MapCoordinate/index.ts +2 -2
- package/package/Matrix4/index.ts +2 -2
- package/package/Mercator/index.ts +2 -2
- package/package/PieLayout/index.ts +3 -0
- package/package/RawCanvas/index.ts +2 -2
- package/package/SVG/index.ts +2 -2
- package/package/Shader/index.ts +2 -2
- package/package/Texture/index.ts +2 -2
- package/package/TreeLayout/index.ts +2 -2
- package/package/animation/index.ts +5 -2
- package/package/assemble/index.ts +2 -2
- package/package/getLoopColors/index.ts +2 -2
- package/package/getWebGLContext/index.ts +40 -40
- package/package/index.ts +4 -0
- package/package/initOption/index.ts +2 -2
- package/package/mergeOption/index.ts +2 -2
- package/package/move/index.ts +2 -2
- package/package/rotate/index.ts +2 -2
- package/package/ruler/index.ts +2 -2
- package/package/scale/index.ts +2 -2
- package/package/throttle/index.ts +1 -1
- package/package.json +3 -3
- package/src/Canvas.ts +84 -84
- package/src/Eoap.ts +66 -66
- package/src/Matrix4/index.ts +84 -84
- package/src/Matrix4/move.ts +12 -12
- package/src/Matrix4/rotate.ts +15 -15
- package/src/Matrix4/scale.ts +11 -11
- package/src/Matrix4/transform.ts +64 -64
- package/src/Mercator.ts +27 -27
- package/src/SVG.ts +31 -0
- package/src/common/assemble.ts +22 -22
- package/src/common/canvas/arc.ts +51 -51
- package/src/common/canvas/config.ts +176 -176
- package/src/common/canvas/default.ts +64 -64
- package/src/common/canvas/gradient.ts +1 -1
- package/src/common/canvas/index.ts +188 -188
- package/src/common/canvas/painter.ts +443 -443
- package/src/common/canvas/texts.ts +18 -18
- package/src/common/map/getBoundary.ts +15 -15
- package/src/common/map/tool.ts +29 -29
- package/src/common/option.ts +29 -29
- package/src/common/setStyle.ts +5 -5
- package/src/common/svg/config.ts +213 -213
- package/src/common/svg/default.ts +2 -2
- package/src/common/svg/gradient.ts +2 -2
- package/src/common/svg/index.ts +1 -1
- package/src/common/svg/tool.ts +51 -51
- package/src/common/tree/index.ts +25 -25
- package/src/common/tree/toInnerTree.ts +61 -61
- package/src/common/tree/toPlainTree.ts +3 -0
- package/src/common/type.ts +26 -26
- package/src/common/webgl/buffer.ts +79 -79
- package/src/common/webgl/getWebGLContext.ts +45 -45
- package/src/common/webgl/shader.ts +75 -75
- package/src/common/webgl/texture.ts +1 -0
- package/src/coordinate/MapCoordinate.ts +80 -80
- package/src/getLoopColors.ts +42 -42
- package/src/interpolation/Cardinal.ts +110 -110
- package/src/interpolation/Hermite.ts +65 -65
- package/src/layout/BarLayout.ts +249 -0
- package/src/layout/PieLayout.ts +142 -0
- package/src/layout/TreeLayout.ts +4 -1
- package/src/move.ts +7 -7
- package/src/rotate.ts +7 -7
- package/src/ruler.ts +209 -209
- package/src/scale.ts +6 -6
- package/types/Bar.d.ts +92 -0
- package/types/BarConfig.d.ts +5 -0
- package/types/BarLayout.d.ts +49 -0
- package/types/BarOption.d.ts +32 -0
- package/types/Buffer.d.ts +23 -23
- package/types/Canvas.d.ts +352 -352
- package/types/CanvasConfig.d.ts +88 -88
- package/types/CanvasOption.d.ts +8 -8
- package/types/CanvasOpts.d.ts +9 -9
- package/types/Cardinal.d.ts +13 -13
- package/types/Gradient.d.ts +14 -14
- package/types/Hermite.d.ts +18 -18
- package/types/Map.d.ts +9 -9
- package/types/MapConfig.d.ts +27 -27
- package/types/MapCoordinate.d.ts +22 -22
- package/types/Matrix4.d.ts +47 -47
- package/types/Pie.d.ts +74 -0
- package/types/PieConfig.d.ts +27 -0
- package/types/PieLayout.d.ts +41 -0
- package/types/PieOption.d.ts +22 -0
- package/types/SVG.d.ts +4 -0
- package/types/SVGConfig.d.ts +71 -71
- package/types/Shader.d.ts +16 -16
- package/types/Texture.d.ts +16 -16
- package/types/Tree.d.ts +74 -74
- package/types/TreeConfig.d.ts +36 -36
- package/types/TreeLayout.d.ts +59 -59
- package/types/TreeOption.d.ts +48 -48
- package/types/animation.d.ts +7 -1
- package/types/assemble.d.ts +5 -5
- package/types/getLoopColors.d.ts +5 -5
- package/types/getWebGLContext.d.ts +7 -7
- package/types/index.d.ts +16 -0
- package/types/move.d.ts +5 -5
- package/types/option.d.ts +12 -12
- package/types/painterConfig.d.ts +4 -4
- package/types/rotate.d.ts +5 -5
- package/types/ruler.d.ts +10 -10
- package/types/scale.d.ts +5 -5
- package/types/throttle.d.ts +1 -1
- package/types/throttleOption.d.ts +1 -1
- package/types/ui-canvas.d.ts +4 -4
- package/types/uni-canvas.d.ts +3 -3
- package/uni-app/drawImage.js +19 -19
- package/uni-app/ui-canvas.vue +284 -284
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* TreeLayout of VISLite JavaScript Library v1.
|
|
2
|
+
* TreeLayout of VISLite JavaScript Library v1.4.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
/******************************************************************************
|
|
@@ -186,107 +186,114 @@ var Tree = (function () {
|
|
|
186
186
|
return Tree;
|
|
187
187
|
}());
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
*
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
189
|
+
/*!
|
|
190
|
+
* animation of OIPage v1.3.0
|
|
191
|
+
* git+https://github.com/oi-contrib/OIPage.git
|
|
192
|
+
*/
|
|
193
|
+
|
|
194
|
+
//当前正在运动的动画的tick函数堆栈
|
|
195
|
+
var $timers = [];
|
|
196
|
+
//唯一定时器的定时间隔
|
|
197
|
+
var $interval = 13;
|
|
198
|
+
//定时器ID
|
|
199
|
+
var $timerId;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* 动画轮播
|
|
203
|
+
* @param {function} doback 轮询函数,有一个形参deep,0-1,表示执行进度
|
|
204
|
+
* @param {number} duration 动画时长,可选
|
|
205
|
+
* @param {function} callback 动画结束回调,可选,有一个形参deep,0-1,表示执行进度
|
|
206
|
+
*
|
|
207
|
+
* @returns {function} 返回一个函数,调用该函数,可以提前结束动画
|
|
208
|
+
*/
|
|
209
|
+
function animation(doback, duration, callback) {
|
|
210
|
+
if (arguments.length < 2) duration = 400;
|
|
211
|
+
if (arguments.length < 3) callback = function () { };
|
|
212
|
+
|
|
213
|
+
var clock = {
|
|
214
|
+
//把tick函数推入堆栈
|
|
215
|
+
"timer": function (tick, duration, callback) {
|
|
216
|
+
if (!tick) {
|
|
217
|
+
throw new Error('Tick is required!');
|
|
218
|
+
}
|
|
219
|
+
var id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
|
|
220
|
+
$timers.push({
|
|
221
|
+
"id": id,
|
|
222
|
+
"createTime": new Date(),
|
|
223
|
+
"tick": tick,
|
|
224
|
+
"duration": duration,
|
|
225
|
+
"callback": callback
|
|
226
|
+
});
|
|
227
|
+
clock.start();
|
|
228
|
+
return id;
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
//开启唯一的定时器timerId
|
|
232
|
+
"start": function () {
|
|
233
|
+
if (!$timerId) {
|
|
234
|
+
$timerId = setInterval(clock.tick, $interval);
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
//被定时器调用,遍历timers堆栈
|
|
239
|
+
"tick": function () {
|
|
240
|
+
var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
|
|
241
|
+
|
|
242
|
+
$timers = [];
|
|
243
|
+
$timers.length = 0;
|
|
244
|
+
|
|
245
|
+
for (flag = 0; flag < timers.length; flag++) {
|
|
246
|
+
//初始化数据
|
|
247
|
+
timer = timers[flag];
|
|
248
|
+
createTime = timer.createTime;
|
|
249
|
+
tick = timer.tick;
|
|
250
|
+
duration = timer.duration;
|
|
251
|
+
callback = timer.callback;
|
|
252
|
+
|
|
253
|
+
//执行
|
|
254
|
+
passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
|
|
255
|
+
passTime = passTime > 1 ? 1 : passTime;
|
|
256
|
+
tick(passTime);
|
|
257
|
+
if (passTime < 1 && timer.id) {
|
|
258
|
+
//动画没有结束再添加
|
|
259
|
+
$timers.push(timer);
|
|
260
|
+
} else {
|
|
261
|
+
callback(passTime);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if ($timers.length <= 0) {
|
|
265
|
+
clock.stop();
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
//停止定时器,重置timerId=null
|
|
270
|
+
"stop": function () {
|
|
271
|
+
if ($timerId) {
|
|
272
|
+
clearInterval($timerId);
|
|
273
|
+
$timerId = null;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
var id = clock.timer(function (deep) {
|
|
279
|
+
//其中deep为0-1,表示改变的程度
|
|
280
|
+
doback(deep);
|
|
281
|
+
}, duration, callback);
|
|
282
|
+
|
|
283
|
+
return {
|
|
284
|
+
// 一个函数
|
|
285
|
+
// 用于在动画结束前结束动画
|
|
286
|
+
stop: function () {
|
|
287
|
+
var i;
|
|
288
|
+
for (i in $timers) {
|
|
289
|
+
if ($timers[i].id == id) {
|
|
290
|
+
$timers[i].id = void 0;
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
|
|
290
297
|
}
|
|
291
298
|
|
|
292
299
|
function rotate (cx, cy, deg, x, y) {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* TreeLayout of VISLite JavaScript Library v1.
|
|
2
|
+
* TreeLayout of VISLite JavaScript Library v1.4.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
|
-
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,n=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){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 p=1;return function n(r,s){var h=e.children(r,t);p+=h?h.length:0;for(var _=0;h&&_<h.length;_++)o=e.id(h[_]),i[s].children.push(o),i[o]={data:h[_],pid:s,id:o,isOpen:!0,show:!0,deg:0,children:[]},n(h[_],o)}(r,o),{rid:n,value:i,num:p}}(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 p=[],s=0,h=0;for(var _ in o[r]?(i[r].left=.5,i[r].top=.5,i[r].show=!0,s=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==p[n]&&(p[n]=-.5),null==p[n-1]&&(p[n-1]=-.5),i[e.id].top=p[n]+1,p[n]+1+.5*(i[e.pid].children.length-1)-1<p[n-1]&&(i[e.id].top=p[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<=p[n])var _=p[n]+1-i[e.id].top((function t(e,o){i[e].top+=_,p[o]<i[e].top&&(p[o]=i[e].top);for(var n=0;n<i[e].children.length;n++)t(i[e].children[n],o+1)}))(e.id,n);p[n]=i[e.id].top,i[e.id].top+.5>s&&(s=i[e.id].top+.5)}(i[r],0),o)o[_]&&(i[_].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)}(_,i[_].left,i[_].top));return{node:i,root:r,size:s,deep:h+1}}(t,this.__config,e)},t}(),i=[];
|
|
5
|
+
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,n=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){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 p=1;return function n(r,s){var h=e.children(r,t);p+=h?h.length:0;for(var _=0;h&&_<h.length;_++)o=e.id(h[_]),i[s].children.push(o),i[o]={data:h[_],pid:s,id:o,isOpen:!0,show:!0,deg:0,children:[]},n(h[_],o)}(r,o),{rid:n,value:i,num:p}}(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 p=[],s=0,h=0;for(var _ in o[r]?(i[r].left=.5,i[r].top=.5,i[r].show=!0,s=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==p[n]&&(p[n]=-.5),null==p[n-1]&&(p[n-1]=-.5),i[e.id].top=p[n]+1,p[n]+1+.5*(i[e.pid].children.length-1)-1<p[n-1]&&(i[e.id].top=p[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<=p[n])var _=p[n]+1-i[e.id].top((function t(e,o){i[e].top+=_,p[o]<i[e].top&&(p[o]=i[e].top);for(var n=0;n<i[e].children.length;n++)t(i[e].children[n],o+1)}))(e.id,n);p[n]=i[e.id].top,i[e.id].top+.5>s&&(s=i[e.id].top+.5)}(i[r],0),o)o[_]&&(i[_].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)}(_,i[_].left,i[_].top));return{node:i,root:r,size:s,deep:h+1}}(t,this.__config,e)},t}(),i=[];
|
|
6
|
+
/*!
|
|
7
|
+
* animation of OIPage v1.3.0
|
|
8
|
+
* git+https://github.com/oi-contrib/OIPage.git
|
|
9
|
+
*/function r(t,e,o,n,i){var r=Math.cos(o),p=Math.sin(o);return[(n-t)*r-(i-e)*p+t,(n-t)*p+(i-e)*r+e]}var p=function(n){function p(){var t=null!==n&&n.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)}(p,n),p.prototype.setOption=function(t){return e(t,this.__option),this},p.prototype.use=function(t,e){void 0===e&&(e={});var o=n.prototype.use.call(this,t,e);if(0!=this.__option.offsetX||0!=this.__option.offsetY)for(var i in o.node)if(!o.node[i].show){var p=0,s=i;do{s=o.node[s].pid,p++}while(!o.node[s].show);o.node[i].left+=this.__option.offsetX*p,o.node[i].top+=this.__option.offsetY*p}if("rect"==this.__option.type){if("LR"==this.__option.direction||"RL"==this.__option.direction){var h=this.__option.height/o.size,_=this.__option.width/(o.deep-1),d=this.__option.y-.5*this.__option.height,f="LR"==this.__option.direction?1:-1;for(var i in o.node)1==o.deep?(o.node[i].left=this.__option.x+.5*this.__option.width*f,o.node[i].top=this.__option.y):(o.node[i].left=this.__option.x+(o.node[i].left-.5)*_*f,o.node[i].top=o.node[i].top*h+d)}else if("TB"==this.__option.direction||"BT"==this.__option.direction){h=this.__option.width/o.size,_=this.__option.height/(o.deep-1),d=this.__option.x-.5*this.__option.width,f="TB"==this.__option.direction?1:-1;for(var i in o.node)if(o.node[i].deg="TB"==this.__option.direction?.5*Math.PI:-.5*Math.PI,1==o.deep)o.node[i].left=this.__option.x,o.node[i].top=this.__option.y+.5*this.__option.height*f;else{var l=o.node[i].left;o.node[i].left=o.node[i].top*h+d,o.node[i].top=this.__option.y+(l-.5)*_*f}}}else if("circle"==this.__option.type){var u=this.__option.x,c=this.__option.y,a=2*Math.PI/o.size,v=this.__option.radius/(o.deep-1);for(var i in o.node)if(.5==o.node[i].left)o.node[i].left=u,o.node[i].top=c;else{var y=r(u,c,a*o.node[i].top,u+(o.node[i].left-.5)*v,c);o.node[i].deg=a*o.node[i].top,o.node[i].left=y[0],o.node[i].top=y[1]}}return o},p.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},p.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralTree=null,this.__preTree=null,this.__noOpens={},this},p.prototype.doUpdate=function(){var t=this,e=this.use(this.__oralTree,this.__noOpens),n=JSON.parse(JSON.stringify(e));return function(t,e,n){arguments.length<2&&(e=400),arguments.length<3&&(n=function(){});var r={timer:function(t,e,o){if(!t)throw new Error("Tick is required!");var n=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return i.push({id:n,createTime:new Date,tick:t,duration:e,callback:o}),r.start(),n},start:function(){o||(o=setInterval(r.tick,13))},tick:function(){var t,e,o,n,p,s,h,_=i;for((i=[]).length=0,e=0;e<_.length;e++)t=(p=_[e]).createTime,o=p.tick,s=p.duration,n=p.callback,o(h=(h=(+(new Date).valueOf()-t.valueOf())/s)>1?1:h),h<1&&p.id?i.push(p):n(h);i.length<=0&&r.stop()},stop:function(){o&&(clearInterval(o),o=null)}},p=r.timer((function(e){t(e)}),e,n)}((function(o){if(t.__preTree)for(var i in n.node)(e.node[i].show||t.__preTree.node[i].show)&&(n.node[i].show=!0,n.node[i].left=t.__preTree.node[i].left+(e.node[i].left-t.__preTree.node[i].left)*o,n.node[i].top=t.__preTree.node[i].top+(e.node[i].top-t.__preTree.node[i].top)*o);t.__rback(n)}),this.__option.duration,(function(){t.__preTree=e,t.__rback(t.__preTree)})),this},p.prototype.closeNode=function(t){return this.__preTree?(this.__noOpens[t]=!0,this.doUpdate(),this):this},p.prototype.openNode=function(t){return this.__preTree?(this.__noOpens[t]=!1,this.doUpdate(),this):this},p.prototype.toggleNode=function(t){return this.__preTree?(this.__noOpens[t]=!this.__noOpens[t],this.doUpdate(),this):this},p}(n);export{p as default};
|
|
@@ -1,108 +1,119 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* animation of VISLite JavaScript Library v1.
|
|
2
|
+
* animation of VISLite JavaScript Library v1.4.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
5
|
+
/*!
|
|
6
|
+
* animation of OIPage v1.3.0
|
|
7
|
+
* git+https://github.com/oi-contrib/OIPage.git
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
//当前正在运动的动画的tick函数堆栈
|
|
11
|
+
var $timers = [];
|
|
12
|
+
//唯一定时器的定时间隔
|
|
13
|
+
var $interval = 13;
|
|
14
|
+
//定时器ID
|
|
15
|
+
var $timerId;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 动画轮播
|
|
19
|
+
* @param {function} doback 轮询函数,有一个形参deep,0-1,表示执行进度
|
|
20
|
+
* @param {number} duration 动画时长,可选
|
|
21
|
+
* @param {function} callback 动画结束回调,可选,有一个形参deep,0-1,表示执行进度
|
|
22
|
+
*
|
|
23
|
+
* @returns {function} 返回一个函数,调用该函数,可以提前结束动画
|
|
24
|
+
*/
|
|
25
|
+
function animation(doback, duration, callback) {
|
|
26
|
+
if (arguments.length < 2) duration = 400;
|
|
27
|
+
if (arguments.length < 3) callback = function () { };
|
|
28
|
+
|
|
29
|
+
var clock = {
|
|
30
|
+
//把tick函数推入堆栈
|
|
31
|
+
"timer": function (tick, duration, callback) {
|
|
32
|
+
if (!tick) {
|
|
33
|
+
throw new Error('Tick is required!');
|
|
34
|
+
}
|
|
35
|
+
var id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
|
|
36
|
+
$timers.push({
|
|
37
|
+
"id": id,
|
|
38
|
+
"createTime": new Date(),
|
|
39
|
+
"tick": tick,
|
|
40
|
+
"duration": duration,
|
|
41
|
+
"callback": callback
|
|
42
|
+
});
|
|
43
|
+
clock.start();
|
|
44
|
+
return id;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
//开启唯一的定时器timerId
|
|
48
|
+
"start": function () {
|
|
49
|
+
if (!$timerId) {
|
|
50
|
+
$timerId = setInterval(clock.tick, $interval);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
//被定时器调用,遍历timers堆栈
|
|
55
|
+
"tick": function () {
|
|
56
|
+
var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
|
|
57
|
+
|
|
58
|
+
$timers = [];
|
|
59
|
+
$timers.length = 0;
|
|
60
|
+
|
|
61
|
+
for (flag = 0; flag < timers.length; flag++) {
|
|
62
|
+
//初始化数据
|
|
63
|
+
timer = timers[flag];
|
|
64
|
+
createTime = timer.createTime;
|
|
65
|
+
tick = timer.tick;
|
|
66
|
+
duration = timer.duration;
|
|
67
|
+
callback = timer.callback;
|
|
68
|
+
|
|
69
|
+
//执行
|
|
70
|
+
passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
|
|
71
|
+
passTime = passTime > 1 ? 1 : passTime;
|
|
72
|
+
tick(passTime);
|
|
73
|
+
if (passTime < 1 && timer.id) {
|
|
74
|
+
//动画没有结束再添加
|
|
75
|
+
$timers.push(timer);
|
|
76
|
+
} else {
|
|
77
|
+
callback(passTime);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if ($timers.length <= 0) {
|
|
81
|
+
clock.stop();
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
//停止定时器,重置timerId=null
|
|
86
|
+
"stop": function () {
|
|
87
|
+
if ($timerId) {
|
|
88
|
+
clearInterval($timerId);
|
|
89
|
+
$timerId = null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
var id = clock.timer(function (deep) {
|
|
95
|
+
//其中deep为0-1,表示改变的程度
|
|
96
|
+
doback(deep);
|
|
97
|
+
}, duration, callback);
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
// 一个函数
|
|
101
|
+
// 用于在动画结束前结束动画
|
|
102
|
+
stop: function () {
|
|
103
|
+
var i;
|
|
104
|
+
for (i in $timers) {
|
|
105
|
+
if ($timers[i].id == id) {
|
|
106
|
+
$timers[i].id = void 0;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function index (doback, duration, callback) {
|
|
116
|
+
return animation(doback, duration || 400, callback || function () { }).stop;
|
|
106
117
|
}
|
|
107
118
|
|
|
108
|
-
export {
|
|
119
|
+
export { index as default };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* animation of VISLite JavaScript Library v1.
|
|
2
|
+
* animation of VISLite JavaScript Library v1.4.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
/*!
|
|
6
|
+
* animation of OIPage v1.3.0
|
|
7
|
+
* git+https://github.com/oi-contrib/OIPage.git
|
|
8
|
+
*/
|
|
9
|
+
var t,n=[],e=13;function r(r,i,a){return function(r,i,a){arguments.length<2&&(i=400),arguments.length<3&&(a=function(){});var o={timer:function(t,e,r){if(!t)throw new Error("Tick is required!");var i=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return n.push({id:i,createTime:new Date,tick:t,duration:e,callback:r}),o.start(),i},start:function(){t||(t=setInterval(o.tick,e))},tick:function(){var t,e,r,i,a,u,c,f=n;for((n=[]).length=0,e=0;e<f.length;e++)t=(a=f[e]).createTime,r=a.tick,u=a.duration,i=a.callback,r(c=(c=(+(new Date).valueOf()-t.valueOf())/u)>1?1:c),c<1&&a.id?n.push(a):i(c);n.length<=0&&o.stop()},stop:function(){t&&(clearInterval(t),t=null)}},u=o.timer((function(t){r(t)}),i,a);return{stop:function(){var t;for(t in n)if(n[t].id==u)return void(n[t].id=void 0)}}}(r,i||400,a||function(){}).stop}export{r as default};
|
package/lib/assemble/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* assemble of VISLite JavaScript Library v1.
|
|
2
|
+
* assemble of VISLite JavaScript Library v1.4.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
function r(r,t,e,f){for(var n=[],o=0;o<f;o++)n[o]=r;return function(){for(var o=0;o<f;o++){if(n[o]+e<t){n[o]=+(n[o]+e).toFixed(7);break}o<f-1&&(n[o]=r)}return n}}export{r as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* getLoopColors of VISLite JavaScript Library v1.
|
|
2
|
+
* getLoopColors of VISLite JavaScript Library v1.4.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
function r(r,a,g){void 0===a&&(a=1);var t=g?g(a):["rgba(84,112,198,"+a+")","rgba(145,204,117,"+a+")","rgba(250,200,88,"+a+")","rgba(238,102,102,"+a+")","rgba(115,192,222,"+a+")","rgba(59,162,114,"+a+")","rgba(252,132,82,"+a+")","rgba(154,96,180,"+a+")","rgba(234,124,204,"+a+")"],e=[];if(r<=t.length)return t;if(r%t.length==0)for(var n=0;n<r/t.length;n++)e=e.concat(t);else{for(var o=1;o<r/t.length;o++)e=e.concat(t);if(r%t.length==1)e=e.concat(t[4]);else for(var b=0;b<r%t.length;b++)e=e.concat(t[b])}return e}export{r as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* getWebGLContext of VISLite JavaScript Library v1.
|
|
2
|
+
* getWebGLContext of VISLite JavaScript Library v1.4.0
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
var e=function(e,t,i){if(void 0===t&&(t=1),!e)throw new Error("VISLite getWebGLContext:The mount point requires an HTMLElement type but encountered null.");var n,r=e.clientWidth,a=e.clientHeight,o=e;return o._vislite_canvas_?n=o._vislite_canvas_:(n=document.createElement("canvas"),e.appendChild(n),o._vislite_canvas_=n,e.setAttribute("vislite","WebGL")),n.style.width=r+"px",n.setAttribute("width",r+""),n.style.height=a+"px",n.setAttribute("height",a+""),function(e,t,i,n){void 0===i&&(i={}),void 0===n&&(n="scaleToFill");for(var r=["experimental-webgl","webkit-3d","moz-webgl"],a=e.getContext("webgl",i),o=0;o<r.length;o++){try{a=e.getContext(r[o],i)}catch(e){}if(a)break}if(!a)throw new Error("Non canvas or browser does not support webgl.");var l=a.canvas.width,s=a.canvas.height,c=t,v=t;"aspectFit"==n?l>s?c*=s/l:s>l&&(v*=l/s):"aspectFill"==n&&(l>s?v*=l/s:s>l&&(c*=s/l));var h=l*c,u=s*v;return a.viewport(.5*(l-h),.5*(s-u),h,u),a.depthFunc(a.LEQUAL),a.enable(a.DEPTH_TEST),a}(n,t,{},i)};export{e as default};
|