vislite 0.4.1-alpha.0 → 0.4.1-alpha.2
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 +21 -7
- package/lib/Buffer/index.umd.js +2 -2
- package/lib/Buffer/index.umd.min.js +2 -2
- package/lib/Canvas/index.umd.js +48 -35
- package/lib/Canvas/index.umd.min.js +3 -3
- package/lib/Cardinal/index.umd.js +2 -2
- package/lib/Cardinal/index.umd.min.js +2 -2
- package/lib/Eoap/index.umd.js +2 -2
- package/lib/Eoap/index.umd.min.js +2 -2
- package/lib/Hermite/index.umd.js +2 -2
- package/lib/Hermite/index.umd.min.js +2 -2
- package/lib/Matrix4/index.umd.js +2 -2
- package/lib/Matrix4/index.umd.min.js +2 -2
- package/lib/Mercator/index.umd.js +2 -2
- package/lib/Mercator/index.umd.min.js +2 -2
- package/lib/OralCanvas/index.es.js +35 -29
- package/lib/OralCanvas/index.es.min.js +3 -3
- package/lib/OralWebGL/index.es.js +22 -16
- package/lib/OralWebGL/index.es.min.js +3 -3
- package/lib/SVG/index.umd.js +2 -2
- package/lib/SVG/index.umd.min.js +2 -2
- package/lib/Shader/index.umd.js +2 -2
- package/lib/Shader/index.umd.min.js +2 -2
- package/lib/Texture/index.umd.js +2 -2
- package/lib/Texture/index.umd.min.js +2 -2
- package/lib/WebGL/index.umd.js +39 -26
- package/lib/WebGL/index.umd.min.js +3 -3
- package/lib/animation/index.umd.js +2 -2
- package/lib/animation/index.umd.min.js +2 -2
- package/lib/getLoopColors/index.umd.js +2 -2
- package/lib/getLoopColors/index.umd.min.js +2 -2
- package/lib/getWebGLContext/index.umd.js +2 -2
- package/lib/getWebGLContext/index.umd.min.js +2 -2
- package/lib/index.umd.js +178 -89
- package/lib/index.umd.min.js +3 -3
- package/lib/rotate/index.umd.js +2 -2
- package/lib/rotate/index.umd.min.js +2 -2
- package/lib/ruler/index.umd.js +95 -32
- package/lib/ruler/index.umd.min.js +3 -3
- package/lib/viewHandler/index.umd.js +2 -2
- package/lib/viewHandler/index.umd.min.js +2 -2
- package/miniprogram/ui-canvas/index.js +23 -15
- package/miniprogram/ui-canvas/index.wxml +1 -1
- package/package.json +1 -1
- package/src/Canvas.ts +13 -6
- package/src/WebGL.ts +19 -10
- package/src/common/canvas/index.ts +36 -29
- package/src/common/canvas/texts.ts +1 -1
- package/src/common/webgl/index.ts +24 -18
- package/src/ruler.ts +126 -37
- package/types/CanvasOption.d.ts +8 -0
- package/types/WebGLOption.d.ts +8 -0
- package/types/index.d.ts +5 -2
- package/types/ruler.d.ts +6 -1
- package/uni-app/ui-canvas.vue +25 -15
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.4.1-alpha.
|
|
2
|
+
* VISLite JavaScript Library v0.4.1-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*
|
|
5
5
|
* Copyright zxl20070701
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
* https://zxl20070701.github.io/notebook/home.html
|
|
8
8
|
*
|
|
9
|
-
* Publish Date:
|
|
9
|
+
* Publish Date: Sat Aug 12 2023 23:34:54 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
(function (global, factory) {
|
|
12
12
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.4.1-alpha.
|
|
2
|
+
* VISLite JavaScript Library v0.4.1-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*
|
|
5
5
|
* Copyright zxl20070701
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
* https://zxl20070701.github.io/notebook/home.html
|
|
8
8
|
*
|
|
9
|
-
* Publish Date:
|
|
9
|
+
* Publish Date: Sat Aug 12 2023 23:34:54 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
var e,t;e=this,t=function(){"use strict";return function(e,t){if(void 0===t&&(t=1),!e)throw new Error("VISLite getWebGLContext:The mount point requires an HTMLElement type but encountered null.");var n,i=e.clientWidth,o=e.clientHeight,r=e;return r._vislite_canvas_?n=r._vislite_canvas_:(n=document.createElement("canvas"),e.appendChild(n),r._vislite_canvas_=n,e.setAttribute("vislite","WebGL")),n.style.width=i+"px",n.setAttribute("width",i+""),n.style.height=o+"px",n.setAttribute("height",o+""),function(e,t,n){void 0===n&&(n={});for(var i=["webgl","experimental-webgl","webkit-3d","moz-webgl"],o=null,r=0;r<i.length;r++){try{o=e.getContext(i[r],n)}catch(e){}if(o)break}if(!o)throw new Error("Non canvas or browser does not support webgl.");var l=o.canvas.width,a=o.canvas.height,s=l*t,u=a*t;return o.viewport(.5*(l-s),.5*(a-u),s,u),o.depthFunc(o.LEQUAL),o.enable(o.DEPTH_TEST),o}(n,t)}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_getWebGLContext=t();
|
package/lib/index.umd.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VISLite JavaScript Library v0.4.1-alpha.
|
|
2
|
+
* VISLite JavaScript Library v0.4.1-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*
|
|
5
5
|
* Copyright zxl20070701
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
* https://zxl20070701.github.io/notebook/home.html
|
|
8
8
|
*
|
|
9
|
-
* Publish Date:
|
|
9
|
+
* Publish Date: Sat Aug 12 2023 23:34:54 GMT+0800 (中国标准时间)
|
|
10
10
|
*/
|
|
11
11
|
(function (global, factory) {
|
|
12
12
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
};
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
function ruler (maxValue, minValue, num) {
|
|
353
|
+
function ruler (maxValue, minValue, num, option) {
|
|
354
354
|
if (maxValue < minValue) {
|
|
355
355
|
var temp = minValue;
|
|
356
356
|
minValue = maxValue;
|
|
@@ -380,35 +380,98 @@
|
|
|
380
380
|
return +(temp + "1");
|
|
381
381
|
}
|
|
382
382
|
})(maxValue - minValue);
|
|
383
|
-
var
|
|
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
|
-
rulerArray.
|
|
383
|
+
var distance100_oral = Math.ceil((maxValue - minValue) * times100 / num);
|
|
384
|
+
var getResult = function (changValue) {
|
|
385
|
+
var distance100 = {
|
|
386
|
+
3: 2,
|
|
387
|
+
4: 5,
|
|
388
|
+
6: 5,
|
|
389
|
+
7: 5,
|
|
390
|
+
8: 10,
|
|
391
|
+
9: 10,
|
|
392
|
+
11: 10,
|
|
393
|
+
12: 10,
|
|
394
|
+
13: 15,
|
|
395
|
+
14: 15,
|
|
396
|
+
16: 15,
|
|
397
|
+
17: 15,
|
|
398
|
+
18: 20,
|
|
399
|
+
19: 20,
|
|
400
|
+
21: 20,
|
|
401
|
+
22: 20,
|
|
402
|
+
23: 25,
|
|
403
|
+
24: 25,
|
|
404
|
+
26: 25,
|
|
405
|
+
27: 25
|
|
406
|
+
}[distance100_oral + changValue] || (distance100_oral + changValue);
|
|
407
|
+
var distance = distance100 / times100;
|
|
408
|
+
var begin = Math.floor(minValue / distance) * distance;
|
|
409
|
+
var rulerArray = [];
|
|
410
|
+
rulerArray.push(begin);
|
|
411
|
+
for (var index = 1; rulerArray[rulerArray.length - 1] < maxValue; index++) {
|
|
412
|
+
rulerArray.push(begin + distance * index);
|
|
413
|
+
}
|
|
414
|
+
return rulerArray;
|
|
415
|
+
};
|
|
416
|
+
var rulerArray = getResult(0);
|
|
417
|
+
var balanceMax = function () {
|
|
418
|
+
var rulerArray_temp = [];
|
|
419
|
+
var changeDist = rulerArray[rulerArray.length - 1] - option.max;
|
|
420
|
+
for (var index = 0; index < rulerArray.length; index++) {
|
|
421
|
+
if (index + 1 < rulerArray.length && rulerArray[index + 1] - changeDist < minValue) ;
|
|
422
|
+
else {
|
|
423
|
+
rulerArray_temp.push(rulerArray[index] - changeDist);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return rulerArray_temp;
|
|
427
|
+
};
|
|
428
|
+
var balanceMin = function () {
|
|
429
|
+
var rulerArray_temp = [];
|
|
430
|
+
var changeDist = rulerArray[0] - option.min;
|
|
431
|
+
for (var index = 0; index < rulerArray.length; index++) {
|
|
432
|
+
rulerArray_temp[index] = rulerArray[index] - changeDist;
|
|
433
|
+
if (maxValue <= rulerArray_temp[index])
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
return rulerArray_temp;
|
|
437
|
+
};
|
|
438
|
+
if (option) {
|
|
439
|
+
if ('max' in option && 'min' in option && option.max >= maxValue && option.min <= minValue) {
|
|
440
|
+
var isAnswer = function () {
|
|
441
|
+
if (rulerArray[0] >= option.min && rulerArray[rulerArray.length - 1] <= option.max)
|
|
442
|
+
return true;
|
|
443
|
+
var rulerArray_max = balanceMax();
|
|
444
|
+
if (rulerArray_max[0] >= option.min && rulerArray_max[rulerArray_max.length - 1] <= option.max) {
|
|
445
|
+
rulerArray = rulerArray_max;
|
|
446
|
+
return true;
|
|
447
|
+
}
|
|
448
|
+
var rulerArray_min = balanceMin();
|
|
449
|
+
if (rulerArray_min[0] >= option.min && rulerArray_min[rulerArray_max.length - 1] <= option.max) {
|
|
450
|
+
rulerArray = rulerArray_min;
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
if (isAnswer())
|
|
455
|
+
return rulerArray;
|
|
456
|
+
for (var changValue = 1; changValue < 100; changValue++) {
|
|
457
|
+
rulerArray = getResult(changValue);
|
|
458
|
+
if (isAnswer())
|
|
459
|
+
return rulerArray;
|
|
460
|
+
rulerArray = getResult(-changValue);
|
|
461
|
+
if (isAnswer())
|
|
462
|
+
return rulerArray;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if ('max' in option && option.max >= maxValue) {
|
|
466
|
+
if (option.max < rulerArray[rulerArray.length - 1]) {
|
|
467
|
+
rulerArray = balanceMax();
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
else if ('min' in option && option.min <= minValue) {
|
|
471
|
+
if (option.min > rulerArray[0]) {
|
|
472
|
+
rulerArray = balanceMin();
|
|
473
|
+
}
|
|
474
|
+
}
|
|
412
475
|
}
|
|
413
476
|
return rulerArray;
|
|
414
477
|
}
|
|
@@ -931,7 +994,7 @@
|
|
|
931
994
|
function texts (painter, contents, width, height, doback) {
|
|
932
995
|
var lineNumber = 0, content = "";
|
|
933
996
|
for (var i = 0; i < contents.length; i++) {
|
|
934
|
-
if (painter.measureText(content + contents[i]).width > width) {
|
|
997
|
+
if (painter.measureText(content + contents[i]).width > width || /\n$/.test(content)) {
|
|
935
998
|
lineNumber += 1;
|
|
936
999
|
doback(content, (lineNumber - 0.5) * height);
|
|
937
1000
|
content = contents[i];
|
|
@@ -1274,9 +1337,9 @@
|
|
|
1274
1337
|
var Canvas$1 = (function (_super) {
|
|
1275
1338
|
__extends(Canvas, _super);
|
|
1276
1339
|
function Canvas(ViewCanvas, RegionCanvas) {
|
|
1277
|
-
var _this = _super.call(this, ViewCanvas, {}, new Painter(RegionCanvas, {
|
|
1340
|
+
var _this = _super.call(this, ViewCanvas, {}, RegionCanvas ? new Painter(RegionCanvas, {
|
|
1278
1341
|
willReadFrequently: true,
|
|
1279
|
-
})) || this;
|
|
1342
|
+
}) : null) || this;
|
|
1280
1343
|
_this.name = "Canvas";
|
|
1281
1344
|
_this.__regionList = {};
|
|
1282
1345
|
_this.__regionAssemble = assemble(0, 255, 10, 3);
|
|
@@ -1291,38 +1354,44 @@
|
|
|
1291
1354
|
return this;
|
|
1292
1355
|
};
|
|
1293
1356
|
Canvas.prototype.setRegion = function (regionName) {
|
|
1294
|
-
if (
|
|
1295
|
-
if (
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1357
|
+
if (this.__region) {
|
|
1358
|
+
if (regionName) {
|
|
1359
|
+
if (this.__regionList[regionName] == undefined) {
|
|
1360
|
+
var tempColor = this.__regionAssemble();
|
|
1361
|
+
this.__regionList[regionName] =
|
|
1362
|
+
"rgb(" + tempColor[0] + "," + tempColor[1] + "," + tempColor[2] + ")";
|
|
1363
|
+
}
|
|
1364
|
+
this.__region.useConfig("fillStyle", this.__regionList[regionName]) &&
|
|
1365
|
+
this.__region.useConfig("strokeStyle", this.__regionList[regionName]);
|
|
1366
|
+
}
|
|
1367
|
+
else {
|
|
1368
|
+
this.__region.useConfig("fillStyle", "#000000") &&
|
|
1369
|
+
this.__region.useConfig("strokeStyle", "#000000");
|
|
1299
1370
|
}
|
|
1300
|
-
this.__region.useConfig("fillStyle", this.__regionList[regionName]) &&
|
|
1301
|
-
this.__region.useConfig("strokeStyle", this.__regionList[regionName]);
|
|
1302
|
-
}
|
|
1303
|
-
else {
|
|
1304
|
-
this.__region.useConfig("fillStyle", "#000000") &&
|
|
1305
|
-
this.__region.useConfig("strokeStyle", "#000000");
|
|
1306
1371
|
}
|
|
1307
1372
|
return this;
|
|
1308
1373
|
};
|
|
1309
1374
|
Canvas.prototype.getRegion = function (x, y) {
|
|
1310
1375
|
var _this = this;
|
|
1311
1376
|
return new Promise(function (resolve, reject) {
|
|
1312
|
-
var imgData = _this.__region.painter.getImageData(x - 0.5, y - 0.5, 1, 1)
|
|
1377
|
+
var imgData = _this.__region ? _this.__region.painter.getImageData(x - 0.5, y - 0.5, 1, 1) : {
|
|
1378
|
+
data: [0, 0, 0, 0]
|
|
1379
|
+
};
|
|
1313
1380
|
var currentRGBA = imgData.data;
|
|
1314
1381
|
var doit = function () {
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1382
|
+
if (_this.__region) {
|
|
1383
|
+
for (var key in _this.__regionList) {
|
|
1384
|
+
if ("rgb(" +
|
|
1385
|
+
currentRGBA[0] +
|
|
1386
|
+
"," +
|
|
1387
|
+
currentRGBA[1] +
|
|
1388
|
+
"," +
|
|
1389
|
+
currentRGBA[2] +
|
|
1390
|
+
")" ==
|
|
1391
|
+
_this.__regionList[key]) {
|
|
1392
|
+
resolve(key);
|
|
1393
|
+
break;
|
|
1394
|
+
}
|
|
1326
1395
|
}
|
|
1327
1396
|
}
|
|
1328
1397
|
resolve("");
|
|
@@ -1347,7 +1416,7 @@
|
|
|
1347
1416
|
};
|
|
1348
1417
|
Canvas.prototype.getContext = function (isRegion) {
|
|
1349
1418
|
if (isRegion === void 0) { isRegion = false; }
|
|
1350
|
-
return isRegion ? this.__region.painter : this.painter;
|
|
1419
|
+
return isRegion ? (this.__region ? this.__region.painter : null) : this.painter;
|
|
1351
1420
|
};
|
|
1352
1421
|
Canvas.prototype.createLinearGradient = function (x0, y0, x1, y1) {
|
|
1353
1422
|
return linearGradient(this.painter, x0, y0, x1, y1);
|
|
@@ -1372,11 +1441,14 @@
|
|
|
1372
1441
|
|
|
1373
1442
|
var Canvas = (function (_super) {
|
|
1374
1443
|
__extends(Canvas, _super);
|
|
1375
|
-
function Canvas(el) {
|
|
1444
|
+
function Canvas(el, option) {
|
|
1445
|
+
if (option === void 0) { option = {}; }
|
|
1376
1446
|
var _this = this;
|
|
1377
1447
|
if (!el) {
|
|
1378
1448
|
throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");
|
|
1379
1449
|
}
|
|
1450
|
+
if (!('region' in option))
|
|
1451
|
+
option.region = true;
|
|
1380
1452
|
var width = el.clientWidth, height = el.clientHeight;
|
|
1381
1453
|
var ViewCanvas, RegionCanvas;
|
|
1382
1454
|
var _el = el;
|
|
@@ -1387,16 +1459,20 @@
|
|
|
1387
1459
|
else {
|
|
1388
1460
|
ViewCanvas = document.createElement('canvas');
|
|
1389
1461
|
el.appendChild(ViewCanvas);
|
|
1390
|
-
|
|
1462
|
+
if (option.region) {
|
|
1463
|
+
RegionCanvas = document.createElement('canvas');
|
|
1464
|
+
}
|
|
1391
1465
|
_el._vislite_canvas_ = [ViewCanvas, RegionCanvas];
|
|
1392
1466
|
el.setAttribute('vislite', 'Canvas');
|
|
1393
1467
|
}
|
|
1394
1468
|
for (var _i = 0, _a = [ViewCanvas, RegionCanvas]; _i < _a.length; _i++) {
|
|
1395
1469
|
var canvas = _a[_i];
|
|
1396
|
-
canvas
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1470
|
+
if (canvas) {
|
|
1471
|
+
canvas.style.width = width + "px";
|
|
1472
|
+
canvas.setAttribute('width', width + "");
|
|
1473
|
+
canvas.style.height = height + "px";
|
|
1474
|
+
canvas.setAttribute('height', height + "");
|
|
1475
|
+
}
|
|
1400
1476
|
}
|
|
1401
1477
|
_this = _super.call(this, ViewCanvas, RegionCanvas) || this;
|
|
1402
1478
|
_this.__canvas = ViewCanvas;
|
|
@@ -1670,7 +1746,9 @@
|
|
|
1670
1746
|
};
|
|
1671
1747
|
this.__unique = new Date().valueOf();
|
|
1672
1748
|
this.painter = getWebGLContext$1(ViewCanvas, scale);
|
|
1673
|
-
|
|
1749
|
+
if (RegionCanvas) {
|
|
1750
|
+
this.__regionPainter = getWebGLContext$1(RegionCanvas, scale, {});
|
|
1751
|
+
}
|
|
1674
1752
|
var proportion = this.painter.canvas.width / this.painter.canvas.height;
|
|
1675
1753
|
var xProportion = 1;
|
|
1676
1754
|
var yProportion = 1;
|
|
@@ -1700,8 +1778,10 @@
|
|
|
1700
1778
|
WebGL.prototype.review = function (isUpdateRegion) {
|
|
1701
1779
|
if (isUpdateRegion === void 0) { isUpdateRegion = false; }
|
|
1702
1780
|
if (isUpdateRegion) {
|
|
1703
|
-
this.__regionPainter
|
|
1704
|
-
|
|
1781
|
+
if (this.__regionPainter) {
|
|
1782
|
+
this.__regionPainter.clearColor(1, 1, 1, 1);
|
|
1783
|
+
this.__regionPainter.clear(this.__regionPainter.COLOR_BUFFER_BIT);
|
|
1784
|
+
}
|
|
1705
1785
|
}
|
|
1706
1786
|
else {
|
|
1707
1787
|
this.painter.clearColor(1, 1, 1, 1);
|
|
@@ -1726,18 +1806,20 @@
|
|
|
1726
1806
|
this.setRegion(object3D.region);
|
|
1727
1807
|
for (var index = 0; index < object3D.mesh.length; index++) {
|
|
1728
1808
|
if (isUpdateRegion) {
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1809
|
+
if (this.__regionPainter) {
|
|
1810
|
+
doDraw("painter" + this.__unique, this.__regionPainter, {
|
|
1811
|
+
geometry: object3D.mesh[index].geometry,
|
|
1812
|
+
material: {
|
|
1813
|
+
color: {
|
|
1814
|
+
r: this.__regionColor[0],
|
|
1815
|
+
g: this.__regionColor[1],
|
|
1816
|
+
b: this.__regionColor[2],
|
|
1817
|
+
alpha: this.__regionColor[3]
|
|
1818
|
+
}
|
|
1737
1819
|
}
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
|
|
1820
|
+
}, meshWorld, globalWorld);
|
|
1821
|
+
this.__getColor = getColorFactory(this.__regionPainter);
|
|
1822
|
+
}
|
|
1741
1823
|
}
|
|
1742
1824
|
else {
|
|
1743
1825
|
doDraw("region" + this.__unique, this.painter, object3D.mesh[index], meshWorld, globalWorld);
|
|
@@ -1805,10 +1887,13 @@
|
|
|
1805
1887
|
|
|
1806
1888
|
var WebGL = (function (_super) {
|
|
1807
1889
|
__extends(WebGL, _super);
|
|
1808
|
-
function WebGL(el) {
|
|
1890
|
+
function WebGL(el, option) {
|
|
1891
|
+
if (option === void 0) { option = {}; }
|
|
1809
1892
|
if (!el) {
|
|
1810
1893
|
throw new Error("VISLite WebGL:The mount point requires an HTMLElement type but encountered null.");
|
|
1811
1894
|
}
|
|
1895
|
+
if (!('region' in option))
|
|
1896
|
+
option.region = true;
|
|
1812
1897
|
var width = el.clientWidth, height = el.clientHeight;
|
|
1813
1898
|
var ViewCanvas, RegionCanvas;
|
|
1814
1899
|
var _el = el;
|
|
@@ -1817,11 +1902,13 @@
|
|
|
1817
1902
|
RegionCanvas = _el._vislite_canvas_[1];
|
|
1818
1903
|
}
|
|
1819
1904
|
else {
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1905
|
+
if (option.region) {
|
|
1906
|
+
RegionCanvas = document.createElement('canvas');
|
|
1907
|
+
el.appendChild(RegionCanvas);
|
|
1908
|
+
RegionCanvas.style.position = 'absolute';
|
|
1909
|
+
RegionCanvas.style.zIndex = "-1";
|
|
1910
|
+
RegionCanvas.style.opacity = "0";
|
|
1911
|
+
}
|
|
1825
1912
|
ViewCanvas = document.createElement('canvas');
|
|
1826
1913
|
el.appendChild(ViewCanvas);
|
|
1827
1914
|
_el._vislite_canvas_ = [ViewCanvas, RegionCanvas];
|
|
@@ -1829,10 +1916,12 @@
|
|
|
1829
1916
|
}
|
|
1830
1917
|
for (var _i = 0, _a = [ViewCanvas, RegionCanvas]; _i < _a.length; _i++) {
|
|
1831
1918
|
var canvas = _a[_i];
|
|
1832
|
-
canvas
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1919
|
+
if (canvas) {
|
|
1920
|
+
canvas.style.width = width + "px";
|
|
1921
|
+
canvas.setAttribute('width', width + "");
|
|
1922
|
+
canvas.style.height = height + "px";
|
|
1923
|
+
canvas.setAttribute('height', height + "");
|
|
1924
|
+
}
|
|
1836
1925
|
}
|
|
1837
1926
|
return _super.call(this, ViewCanvas, RegionCanvas) || this;
|
|
1838
1927
|
}
|