vislite 1.9.0-alpha.2 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS.txt +6 -6
- package/CHANGELOG +12 -2
- package/LICENSE +20 -20
- package/README.md +1 -1
- package/lib/BarLayout/index.es.js +119 -128
- package/lib/BarLayout/index.es.min.js +1 -10
- package/lib/Buffer/index.es.js +0 -4
- package/lib/Buffer/index.es.min.js +0 -4
- package/lib/Canvas/index.es.js +0 -4
- package/lib/Canvas/index.es.min.js +0 -4
- package/lib/Cardinal/index.es.js +0 -4
- package/lib/Cardinal/index.es.min.js +0 -4
- package/lib/Eoap/index.es.js +0 -4
- package/lib/Eoap/index.es.min.js +0 -4
- package/lib/Hermite/index.es.js +0 -4
- package/lib/Hermite/index.es.min.js +0 -4
- package/lib/MapCoordinate/index.es.js +0 -4
- package/lib/MapCoordinate/index.es.min.js +0 -4
- package/lib/Matrix4/index.es.js +0 -4
- package/lib/Matrix4/index.es.min.js +0 -4
- package/lib/Mercator/index.es.js +0 -4
- package/lib/Mercator/index.es.min.js +0 -4
- package/lib/PieLayout/index.es.js +119 -128
- package/lib/PieLayout/index.es.min.js +1 -9
- package/lib/RawCanvas/index.es.js +0 -4
- package/lib/RawCanvas/index.es.min.js +0 -4
- package/lib/SVG/index.es.js +14 -9
- package/lib/SVG/index.es.min.js +1 -5
- package/lib/Shader/index.es.js +0 -4
- package/lib/Shader/index.es.min.js +0 -4
- package/lib/Texture/index.es.js +0 -4
- package/lib/Texture/index.es.min.js +0 -4
- package/lib/TreeLayout/index.es.js +119 -128
- package/lib/TreeLayout/index.es.min.js +1 -9
- package/lib/animation/index.es.js +119 -128
- package/lib/animation/index.es.min.js +0 -8
- package/lib/assemble/index.es.js +0 -4
- package/lib/assemble/index.es.min.js +0 -4
- package/lib/getLoopColors/index.es.js +0 -4
- package/lib/getLoopColors/index.es.min.js +0 -4
- package/lib/getWebGLContext/index.es.js +0 -4
- package/lib/getWebGLContext/index.es.min.js +0 -4
- package/lib/index.umd.js +183 -184
- package/lib/index.umd.min.js +2 -12
- package/lib/initOption/index.es.js +0 -4
- package/lib/initOption/index.es.min.js +0 -4
- package/lib/mergeOption/index.es.js +0 -4
- package/lib/mergeOption/index.es.min.js +0 -4
- package/lib/move/index.es.js +0 -4
- package/lib/move/index.es.min.js +0 -4
- package/lib/rotate/index.es.js +0 -4
- package/lib/rotate/index.es.min.js +0 -4
- package/lib/ruler/index.es.js +0 -4
- package/lib/ruler/index.es.min.js +0 -4
- package/lib/scale/index.es.js +0 -4
- package/lib/scale/index.es.min.js +0 -4
- package/lib/throttle/index.es.js +49 -58
- package/lib/throttle/index.es.min.js +0 -8
- 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 +125 -125
- 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 +2 -2
- 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 +2 -2
- 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 -5
- 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 +84 -84
- 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 +2 -2
- package/package.json +75 -75
- package/src/Canvas.ts +89 -89
- 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 +69 -55
- 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 +31 -31
- package/src/common/canvas/index.ts +189 -189
- 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 +29 -29
- package/src/common/svg/gradient.ts +53 -53
- package/src/common/svg/index.ts +420 -420
- 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 +135 -135
- 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 +98 -98
- 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 -249
- package/src/layout/TreeLayout.ts +200 -200
- 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 +91 -91
- package/types/BarConfig.d.ts +4 -4
- package/types/BarLayout.d.ts +48 -48
- package/types/BarOption.d.ts +31 -31
- package/types/Buffer.d.ts +23 -23
- package/types/Canvas.d.ts +375 -375
- package/types/CanvasConfig.d.ts +88 -88
- package/types/CanvasOption.d.ts +13 -13
- 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 +73 -73
- package/types/PieConfig.d.ts +26 -26
- package/types/PieLayout.d.ts +40 -40
- package/types/PieOption.d.ts +21 -21
- package/types/SVG.d.ts +278 -278
- 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 +11 -11
- 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 +196 -196
- 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 +5 -5
- 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 +295 -295
package/lib/index.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v1.9.
|
|
2
|
+
* VISLite JavaScript Library v1.9.1
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -293,130 +293,125 @@
|
|
|
293
293
|
return colors;
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
*
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
$timerId =
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
|
|
296
|
+
//当前正在运动的动画的tick函数堆栈
|
|
297
|
+
var $timers = [];
|
|
298
|
+
//唯一定时器的定时间隔
|
|
299
|
+
var $interval = 13;
|
|
300
|
+
//定时器ID
|
|
301
|
+
var $timerId;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* 动画轮播
|
|
305
|
+
* @param {function} doback 轮询函数,有一个形参deep,0-1,表示执行进度
|
|
306
|
+
* @param {number} duration 动画时长,可选
|
|
307
|
+
* @param {function} callback 动画结束回调,可选,有一个形参deep,0-1,表示执行进度
|
|
308
|
+
*
|
|
309
|
+
* @returns {object} 返回一个对象,包含一个stop方法,用于在动画结束前结束动画
|
|
310
|
+
*/
|
|
311
|
+
function animation$1(doback, duration, callback) {
|
|
312
|
+
if (arguments.length < 2) duration = 400;
|
|
313
|
+
if (arguments.length < 3) callback = function () { };
|
|
314
|
+
|
|
315
|
+
var clock = {
|
|
316
|
+
//把tick函数推入堆栈
|
|
317
|
+
"timer": function (tick, duration, callback) {
|
|
318
|
+
if (!tick) {
|
|
319
|
+
throw new Error('Tick is required!');
|
|
320
|
+
}
|
|
321
|
+
var id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
|
|
322
|
+
$timers.push({
|
|
323
|
+
"id": id,
|
|
324
|
+
"createTime": new Date(),
|
|
325
|
+
"tick": tick,
|
|
326
|
+
"duration": duration,
|
|
327
|
+
"callback": callback
|
|
328
|
+
});
|
|
329
|
+
clock.start();
|
|
330
|
+
return id;
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
//开启唯一的定时器timerId
|
|
334
|
+
"start": function () {
|
|
335
|
+
if (!$timerId) {
|
|
336
|
+
try {
|
|
337
|
+
if (globalThis && globalThis.requestAnimationFrame) {
|
|
338
|
+
$timerId = globalThis.requestAnimationFrame(function step() {
|
|
339
|
+
clock.tick();
|
|
340
|
+
if ($timerId) $timerId = globalThis.requestAnimationFrame(step);
|
|
341
|
+
});
|
|
342
|
+
} else {
|
|
343
|
+
$timerId = setInterval(clock.tick, $interval);
|
|
344
|
+
}
|
|
345
|
+
} catch (e) {
|
|
346
|
+
$timerId = setInterval(clock.tick, $interval);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
//被定时器调用,遍历timers堆栈
|
|
352
|
+
"tick": function () {
|
|
353
|
+
var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
|
|
354
|
+
|
|
355
|
+
$timers = [];
|
|
356
|
+
$timers.length = 0;
|
|
357
|
+
|
|
358
|
+
for (flag = 0; flag < timers.length; flag++) {
|
|
359
|
+
//初始化数据
|
|
360
|
+
timer = timers[flag];
|
|
361
|
+
createTime = timer.createTime;
|
|
362
|
+
tick = timer.tick;
|
|
363
|
+
duration = timer.duration;
|
|
364
|
+
callback = timer.callback;
|
|
365
|
+
|
|
366
|
+
//执行
|
|
367
|
+
passTime = (+new Date().valueOf() - createTime.valueOf()) / duration;
|
|
368
|
+
passTime = passTime > 1 ? 1 : passTime;
|
|
369
|
+
tick(passTime);
|
|
370
|
+
if (passTime < 1 && timer.id) {
|
|
371
|
+
//动画没有结束再添加
|
|
372
|
+
$timers.push(timer);
|
|
373
|
+
} else {
|
|
374
|
+
callback(passTime);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if ($timers.length <= 0) {
|
|
378
|
+
clock.stop();
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
|
|
382
|
+
//停止定时器,重置timerId=null
|
|
383
|
+
"stop": function () {
|
|
384
|
+
if ($timerId) {
|
|
385
|
+
try {
|
|
386
|
+
if (globalThis && globalThis.requestAnimationFrame) globalThis.cancelAnimationFrame($timerId);
|
|
387
|
+
else clearInterval($timerId);
|
|
388
|
+
} catch (e) {
|
|
389
|
+
clearInterval($timerId);
|
|
390
|
+
}
|
|
391
|
+
$timerId = null;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
var id = clock.timer(function (deep) {
|
|
397
|
+
//其中deep为0-1,表示改变的程度
|
|
398
|
+
doback(deep);
|
|
399
|
+
}, duration, callback);
|
|
400
|
+
|
|
401
|
+
return {
|
|
402
|
+
// 一个函数
|
|
403
|
+
// 用于在动画结束前结束动画
|
|
404
|
+
stop: function () {
|
|
405
|
+
var i;
|
|
406
|
+
for (i in $timers) {
|
|
407
|
+
if ($timers[i].id == id) {
|
|
408
|
+
$timers[i].id = void 0;
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
420
415
|
}
|
|
421
416
|
|
|
422
417
|
function animation (doback, duration, callback) {
|
|
@@ -1234,11 +1229,20 @@
|
|
|
1234
1229
|
throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");
|
|
1235
1230
|
}
|
|
1236
1231
|
var width = el.clientWidth, height = el.clientHeight;
|
|
1237
|
-
var ViewSVG
|
|
1238
|
-
el
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1232
|
+
var ViewSVG;
|
|
1233
|
+
var _el = el;
|
|
1234
|
+
if (_el._vislite_svg_) {
|
|
1235
|
+
ViewSVG = _el._vislite_svg_[0];
|
|
1236
|
+
}
|
|
1237
|
+
else {
|
|
1238
|
+
ViewSVG = document.createElementNS("http://www.w3.org/2000/svg", 'svg');
|
|
1239
|
+
el.appendChild(ViewSVG);
|
|
1240
|
+
ViewSVG.setAttribute("width", width + "");
|
|
1241
|
+
ViewSVG.setAttribute("height", height + "");
|
|
1242
|
+
ViewSVG.setAttribute("viewBox", "0 0 " + width + " " + height);
|
|
1243
|
+
_el._vislite_svg_ = [ViewSVG];
|
|
1244
|
+
el.setAttribute('vislite', 'SVG');
|
|
1245
|
+
}
|
|
1242
1246
|
_this = _super.call(this, ViewSVG) || this;
|
|
1243
1247
|
_this.__el = el;
|
|
1244
1248
|
return _this;
|
|
@@ -2281,60 +2285,55 @@
|
|
|
2281
2285
|
return Mercator;
|
|
2282
2286
|
}());
|
|
2283
2287
|
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
hadClick = true;
|
|
2334
|
-
oneClick = true;
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
};
|
|
2288
|
+
function throttle(callback, _option) {
|
|
2289
|
+
|
|
2290
|
+
// 缺省值
|
|
2291
|
+
var option = {
|
|
2292
|
+
time: 200,
|
|
2293
|
+
keep: false,
|
|
2294
|
+
opportunity: "end"
|
|
2295
|
+
};
|
|
2296
|
+
|
|
2297
|
+
// 校对
|
|
2298
|
+
if (_option) {
|
|
2299
|
+
for (var key in _option) {
|
|
2300
|
+
option[key] = _option[key];
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
var hadInterval = false, hadClick = false, oneClick = false, arg;
|
|
2305
|
+
return function () {
|
|
2306
|
+
const _this = this;
|
|
2307
|
+
arg = arguments;
|
|
2308
|
+
|
|
2309
|
+
// 如果前置任务都完成了
|
|
2310
|
+
if (!hadInterval) {
|
|
2311
|
+
if (option.opportunity != 'end') {
|
|
2312
|
+
callback.apply(_this, arg);
|
|
2313
|
+
}
|
|
2314
|
+
hadInterval = true;
|
|
2315
|
+
|
|
2316
|
+
var interval = setInterval(() => {
|
|
2317
|
+
if (hadClick) {
|
|
2318
|
+
if (!option.keep) {
|
|
2319
|
+
callback.apply(_this, arg);
|
|
2320
|
+
}
|
|
2321
|
+
} else {
|
|
2322
|
+
if (option.opportunity != 'begin') {
|
|
2323
|
+
if (oneClick || option.opportunity == 'end') callback.apply(_this, arg);
|
|
2324
|
+
}
|
|
2325
|
+
hadInterval = false;
|
|
2326
|
+
oneClick = false;
|
|
2327
|
+
clearInterval(interval);
|
|
2328
|
+
}
|
|
2329
|
+
hadClick = false;
|
|
2330
|
+
}, option.time);
|
|
2331
|
+
} else {
|
|
2332
|
+
hadClick = true;
|
|
2333
|
+
oneClick = true;
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
};
|
|
2338
2337
|
}
|
|
2339
2338
|
|
|
2340
2339
|
function mllData(geoJson) {
|