vislite 0.5.0 → 0.5.2-alpha.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.
Files changed (76) hide show
  1. package/CHANGELOG +137 -132
  2. package/lib/Buffer/index.umd.js +36 -36
  3. package/lib/Buffer/index.umd.min.js +2 -2
  4. package/lib/Canvas/index.umd.js +650 -650
  5. package/lib/Canvas/index.umd.min.js +2 -2
  6. package/lib/Cardinal/index.umd.js +91 -91
  7. package/lib/Cardinal/index.umd.min.js +2 -2
  8. package/lib/Eoap/index.umd.js +34 -34
  9. package/lib/Eoap/index.umd.min.js +2 -2
  10. package/lib/Geometry/index.umd.js +142 -142
  11. package/lib/Geometry/index.umd.min.js +2 -2
  12. package/lib/Hermite/index.umd.js +36 -36
  13. package/lib/Hermite/index.umd.min.js +2 -2
  14. package/lib/Matrix4/index.umd.js +119 -119
  15. package/lib/Matrix4/index.umd.min.js +2 -2
  16. package/lib/Mercator/index.umd.js +20 -20
  17. package/lib/Mercator/index.umd.min.js +2 -2
  18. package/lib/OralCanvas/index.es.js +598 -598
  19. package/lib/OralCanvas/index.es.min.js +2 -2
  20. package/lib/OralWebGL/index.es.js +524 -524
  21. package/lib/OralWebGL/index.es.min.js +2 -2
  22. package/lib/SVG/index.umd.js +406 -406
  23. package/lib/SVG/index.umd.min.js +2 -2
  24. package/lib/Shader/index.umd.js +61 -61
  25. package/lib/Shader/index.umd.min.js +2 -2
  26. package/lib/Texture/index.umd.js +53 -53
  27. package/lib/Texture/index.umd.min.js +2 -2
  28. package/lib/TreeLayout/index.umd.js +363 -363
  29. package/lib/TreeLayout/index.umd.min.js +2 -2
  30. package/lib/WebGL/index.umd.js +571 -571
  31. package/lib/WebGL/index.umd.min.js +2 -2
  32. package/lib/animation/index.umd.js +72 -72
  33. package/lib/animation/index.umd.min.js +2 -2
  34. package/lib/formatColor/index.umd.js +40 -40
  35. package/lib/formatColor/index.umd.min.js +2 -2
  36. package/lib/getLoopColors/index.umd.js +36 -36
  37. package/lib/getLoopColors/index.umd.min.js +2 -2
  38. package/lib/getWebGLContext/index.umd.js +44 -44
  39. package/lib/getWebGLContext/index.umd.min.js +2 -2
  40. package/lib/index.umd.js +2647 -2647
  41. package/lib/index.umd.min.js +2 -2
  42. package/lib/resizeObserver/index.umd.js +29 -29
  43. package/lib/resizeObserver/index.umd.min.js +2 -2
  44. package/lib/rotate/index.umd.js +8 -8
  45. package/lib/rotate/index.umd.min.js +2 -2
  46. package/lib/ruler/index.umd.js +126 -126
  47. package/lib/ruler/index.umd.min.js +2 -2
  48. package/lib/throttle/index.umd.js +49 -49
  49. package/lib/throttle/index.umd.min.js +2 -2
  50. package/lib/viewHandler/index.umd.js +120 -120
  51. package/lib/viewHandler/index.umd.min.js +2 -2
  52. package/package/Geometry/index.ts +2 -2
  53. package/package/index.ts +72 -72
  54. package/package.json +66 -66
  55. package/src/Eoap.ts +66 -66
  56. package/src/Geometry.ts +82 -82
  57. package/src/Matrix4/index.ts +76 -76
  58. package/src/Mercator.ts +27 -27
  59. package/src/TreeLayout/index.ts +186 -186
  60. package/src/common/geometry/prism-horizontal.ts +33 -33
  61. package/src/common/geometry/prism-vertical.ts +40 -40
  62. package/src/common/geometry/sphere-fragment.ts +39 -39
  63. package/src/common/geometry/tool/circle.ts +11 -11
  64. package/src/common/svg/index.ts +344 -344
  65. package/src/rotate.ts +7 -7
  66. package/types/CanvasConfig.d.ts +106 -106
  67. package/types/Geometry.d.ts +40 -40
  68. package/types/GeometryOption.d.ts +11 -11
  69. package/types/GeometryResult.d.ts +18 -18
  70. package/types/Map.d.ts +9 -9
  71. package/types/Matrix4.d.ts +42 -42
  72. package/types/SVG.d.ts +215 -215
  73. package/types/TreeLayout.d.ts +54 -54
  74. package/types/index.d.ts +169 -169
  75. package/types/rotate.d.ts +2 -2
  76. package/uni-app/ui-canvas.vue +206 -202
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.5.0
2
+ * VISLite JavaScript Library v0.5.2-alpha.1
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: Sat Sep 30 2023 19:14:04 GMT+0800 (中国标准时间)
9
+ * Publish Date: Thu Oct 12 2023 15:44:35 GMT+0800 (China Standard Time)
10
10
  */
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -52,422 +52,422 @@
52
52
 
53
53
  var XLINK_ATTRIBUTE = ["href", "title", "show", "type", "role", "actuate"];
54
54
 
55
- function toNode(tagname) {
56
- return document.createElementNS('http://www.w3.org/2000/svg', tagname);
57
- }
58
- var _setAttribute = function (el, key, value) {
59
- if (XLINK_ATTRIBUTE.indexOf(key) > -1) {
60
- el.setAttributeNS("http://www.w3.org/1999/xlink", 'xlink:' + key, value + "");
61
- }
62
- else {
63
- el.setAttribute(key, value + "");
64
- }
65
- };
66
- var setAttribute = _setAttribute;
67
- function getAttribute(el, key) {
68
- if (XLINK_ATTRIBUTE.indexOf(key) > -1)
69
- key = 'xlink:' + key;
70
- return el.getAttribute(key);
71
- }
72
- function full(el, config) {
73
- _setAttribute(el, "stroke", config.strokeStyle);
74
- _setAttribute(el, "fill", config.fillStyle);
75
- _setAttribute(el, "stroke-dasharray", config.lineDash.join(','));
76
- }
77
- function fill(el, config) {
78
- _setAttribute(el, "fill", config.fillStyle);
79
- }
80
- function stroke(el, config) {
81
- _setAttribute(el, "stroke", config.strokeStyle);
82
- _setAttribute(el, "fill", "none");
83
- _setAttribute(el, "stroke-dasharray", config.lineDash.join(','));
55
+ function toNode(tagname) {
56
+ return document.createElementNS('http://www.w3.org/2000/svg', tagname);
57
+ }
58
+ var _setAttribute = function (el, key, value) {
59
+ if (XLINK_ATTRIBUTE.indexOf(key) > -1) {
60
+ el.setAttributeNS("http://www.w3.org/1999/xlink", 'xlink:' + key, value + "");
61
+ }
62
+ else {
63
+ el.setAttribute(key, value + "");
64
+ }
65
+ };
66
+ var setAttribute = _setAttribute;
67
+ function getAttribute(el, key) {
68
+ if (XLINK_ATTRIBUTE.indexOf(key) > -1)
69
+ key = 'xlink:' + key;
70
+ return el.getAttribute(key);
71
+ }
72
+ function full(el, config) {
73
+ _setAttribute(el, "stroke", config.strokeStyle);
74
+ _setAttribute(el, "fill", config.fillStyle);
75
+ _setAttribute(el, "stroke-dasharray", config.lineDash.join(','));
76
+ }
77
+ function fill(el, config) {
78
+ _setAttribute(el, "fill", config.fillStyle);
79
+ }
80
+ function stroke(el, config) {
81
+ _setAttribute(el, "stroke", config.strokeStyle);
82
+ _setAttribute(el, "fill", "none");
83
+ _setAttribute(el, "stroke-dasharray", config.lineDash.join(','));
84
84
  }
85
85
 
86
- function setStyle (el, styles) {
87
- for (var key in styles) {
88
- el.style[key] = styles[key];
89
- }
86
+ function setStyle (el, styles) {
87
+ for (var key in styles) {
88
+ el.style[key] = styles[key];
89
+ }
90
90
  }
91
91
 
92
- var rotate$1 = function (cx, cy, deg, x, y) {
93
- var cos = Math.cos(deg), sin = Math.sin(deg);
94
- return [
95
- +((x - cx) * cos - (y - cy) * sin + cx).toFixed(7),
96
- +((x - cx) * sin + (y - cy) * cos + cy).toFixed(7)
97
- ];
98
- };
99
- function arc (beginA, rotateA, cx, cy, r1, r2, doback) {
100
- if (rotateA < 0) {
101
- beginA += rotateA;
102
- rotateA *= -1;
103
- }
104
- var temp = [], p;
105
- p = rotate$1(0, 0, beginA, r1, 0);
106
- temp[0] = p[0];
107
- temp[1] = p[1];
108
- p = rotate$1(0, 0, rotateA, p[0], p[1]);
109
- temp[2] = p[0];
110
- temp[3] = p[1];
111
- p = rotate$1(0, 0, beginA, r2, 0);
112
- temp[4] = p[0];
113
- temp[5] = p[1];
114
- p = rotate$1(0, 0, rotateA, p[0], p[1]);
115
- temp[6] = p[0];
116
- temp[7] = p[1];
117
- doback(beginA, beginA + rotateA, temp[0] + cx, temp[1] + cy, temp[4] + cx, temp[5] + cy, temp[2] + cx, temp[3] + cy, temp[6] + cx, temp[7] + cy, (r2 - r1) * 0.5);
92
+ var rotate$1 = function (cx, cy, deg, x, y) {
93
+ var cos = Math.cos(deg), sin = Math.sin(deg);
94
+ return [
95
+ +((x - cx) * cos - (y - cy) * sin + cx).toFixed(7),
96
+ +((x - cx) * sin + (y - cy) * cos + cy).toFixed(7)
97
+ ];
98
+ };
99
+ function arc (beginA, rotateA, cx, cy, r1, r2, doback) {
100
+ if (rotateA < 0) {
101
+ beginA += rotateA;
102
+ rotateA *= -1;
103
+ }
104
+ var temp = [], p;
105
+ p = rotate$1(0, 0, beginA, r1, 0);
106
+ temp[0] = p[0];
107
+ temp[1] = p[1];
108
+ p = rotate$1(0, 0, rotateA, p[0], p[1]);
109
+ temp[2] = p[0];
110
+ temp[3] = p[1];
111
+ p = rotate$1(0, 0, beginA, r2, 0);
112
+ temp[4] = p[0];
113
+ temp[5] = p[1];
114
+ p = rotate$1(0, 0, rotateA, p[0], p[1]);
115
+ temp[6] = p[0];
116
+ temp[7] = p[1];
117
+ doback(beginA, beginA + rotateA, temp[0] + cx, temp[1] + cy, temp[4] + cx, temp[5] + cy, temp[2] + cx, temp[3] + cy, temp[6] + cx, temp[7] + cy, (r2 - r1) * 0.5);
118
118
  }
119
119
 
120
- var initText = function (el, config, x, y, deg) {
121
- if (el.nodeName.toLowerCase() !== "text")
122
- throw new Error("Need a <text> !");
123
- setAttribute(el, "dy", {
124
- top: config["fontSize"] * 0.5,
125
- middle: 0,
126
- bottom: -config["fontSize"] * 0.5,
127
- }[config.textBaseline]);
128
- setStyle(el, {
129
- "text-anchor": {
130
- left: "start",
131
- right: "end",
132
- center: "middle",
133
- }[config.textAlign],
134
- "dominant-baseline": "central",
135
- "font-size": config["fontSize"] + "px",
136
- "font-family": config["fontFamily"],
137
- });
138
- setAttribute(el, "x", x);
139
- setAttribute(el, "y", y);
140
- if (typeof deg == "number") {
141
- deg = deg % 360;
142
- setAttribute(el, "transform", "rotate(" + deg + "," + x + "," + y + ")");
143
- }
144
- };
145
- var initCircle = function (el, cx, cy, r) {
146
- if (el.nodeName.toLowerCase() !== "circle")
147
- throw new Error("Need a <circle> !");
148
- setAttribute(el, "cx", cx);
149
- setAttribute(el, "cy", cy);
150
- setAttribute(el, "r", r);
151
- };
152
- var initPath = function (el, path) {
153
- if (el.nodeName.toLowerCase() !== "path")
154
- throw new Error("Need a <path> !");
155
- setAttribute(el, "d", path);
156
- };
157
- var initRect = function (el, x, y, width, height) {
158
- if (el.nodeName.toLowerCase() !== "rect")
159
- throw new Error("Need a <rect> !");
160
- if (height < 0) {
161
- height *= -1;
162
- y -= height;
163
- }
164
- if (width < 0) {
165
- width *= -1;
166
- x -= width;
167
- }
168
- setAttribute(el, "x", x);
169
- setAttribute(el, "y", y);
170
- setAttribute(el, "width", width);
171
- setAttribute(el, "height", height);
172
- };
173
- var initArc = function (el, config, cx, cy, r1, r2, beginDeg, deg) {
174
- if (el.nodeName.toLowerCase() !== "path")
175
- throw new Error("Need a <path> !");
176
- beginDeg = (beginDeg / 180) * Math.PI;
177
- deg = (deg / 180) * Math.PI;
178
- beginDeg = beginDeg % (Math.PI * 2);
179
- if (r1 > r2) {
180
- var temp = r1;
181
- r1 = r2;
182
- r2 = temp;
183
- }
184
- if (deg >= Math.PI * 1.999999 || deg <= -Math.PI * 1.999999) {
185
- deg = Math.PI * 1.999999;
186
- }
187
- else {
188
- deg = deg % (Math.PI * 2);
189
- }
190
- arc(beginDeg, deg, cx, cy, r1, r2, function (beginA, endA, begInnerX, begInnerY, begOuterX, begOuterY, endInnerX, endInnerY, endOuterX, endOuterY, r) {
191
- var f = endA - beginA > Math.PI ? 1 : 0, d = "M" + begInnerX + " " + begInnerY;
192
- if (r < 0)
193
- r = -r;
194
- d +=
195
- "A" + r1 + " " + r1 + " 0 " + f + " 1 " + endInnerX + " " + endInnerY;
196
- if (config.arcEndCap == "round")
197
- d += "A" + r + " " + r + " " + " 0 1 0 " + endOuterX + " " + endOuterY;
198
- else if (config.arcEndCap == "-round")
199
- d += "A" + r + " " + r + " " + " 0 1 1 " + endOuterX + " " + endOuterY;
200
- else
201
- d += "L" + endOuterX + " " + endOuterY;
202
- d +=
203
- "A" + r2 + " " + r2 + " 0 " + f + " 0 " + begOuterX + " " + begOuterY;
204
- if (config.arcStartCap == "round")
205
- d += "A" + r + " " + r + " " + " 0 1 0 " + begInnerX + " " + begInnerY;
206
- else if (config.arcStartCap == "-round")
207
- d += "A" + r + " " + r + " " + " 0 1 1 " + begInnerX + " " + begInnerY;
208
- else
209
- d += "L" + begInnerX + " " + begInnerY;
210
- if (config.arcStartCap == "butt")
211
- d += "Z";
212
- setAttribute(el, "d", d);
213
- });
120
+ var initText = function (el, config, x, y, deg) {
121
+ if (el.nodeName.toLowerCase() !== "text")
122
+ throw new Error("Need a <text> !");
123
+ setAttribute(el, "dy", {
124
+ top: config["fontSize"] * 0.5,
125
+ middle: 0,
126
+ bottom: -config["fontSize"] * 0.5,
127
+ }[config.textBaseline]);
128
+ setStyle(el, {
129
+ "text-anchor": {
130
+ left: "start",
131
+ right: "end",
132
+ center: "middle",
133
+ }[config.textAlign],
134
+ "dominant-baseline": "central",
135
+ "font-size": config["fontSize"] + "px",
136
+ "font-family": config["fontFamily"],
137
+ });
138
+ setAttribute(el, "x", x);
139
+ setAttribute(el, "y", y);
140
+ if (typeof deg == "number") {
141
+ deg = deg % 360;
142
+ setAttribute(el, "transform", "rotate(" + deg + "," + x + "," + y + ")");
143
+ }
144
+ };
145
+ var initCircle = function (el, cx, cy, r) {
146
+ if (el.nodeName.toLowerCase() !== "circle")
147
+ throw new Error("Need a <circle> !");
148
+ setAttribute(el, "cx", cx);
149
+ setAttribute(el, "cy", cy);
150
+ setAttribute(el, "r", r);
151
+ };
152
+ var initPath = function (el, path) {
153
+ if (el.nodeName.toLowerCase() !== "path")
154
+ throw new Error("Need a <path> !");
155
+ setAttribute(el, "d", path);
156
+ };
157
+ var initRect = function (el, x, y, width, height) {
158
+ if (el.nodeName.toLowerCase() !== "rect")
159
+ throw new Error("Need a <rect> !");
160
+ if (height < 0) {
161
+ height *= -1;
162
+ y -= height;
163
+ }
164
+ if (width < 0) {
165
+ width *= -1;
166
+ x -= width;
167
+ }
168
+ setAttribute(el, "x", x);
169
+ setAttribute(el, "y", y);
170
+ setAttribute(el, "width", width);
171
+ setAttribute(el, "height", height);
172
+ };
173
+ var initArc = function (el, config, cx, cy, r1, r2, beginDeg, deg) {
174
+ if (el.nodeName.toLowerCase() !== "path")
175
+ throw new Error("Need a <path> !");
176
+ beginDeg = (beginDeg / 180) * Math.PI;
177
+ deg = (deg / 180) * Math.PI;
178
+ beginDeg = beginDeg % (Math.PI * 2);
179
+ if (r1 > r2) {
180
+ var temp = r1;
181
+ r1 = r2;
182
+ r2 = temp;
183
+ }
184
+ if (deg >= Math.PI * 1.999999 || deg <= -Math.PI * 1.999999) {
185
+ deg = Math.PI * 1.999999;
186
+ }
187
+ else {
188
+ deg = deg % (Math.PI * 2);
189
+ }
190
+ arc(beginDeg, deg, cx, cy, r1, r2, function (beginA, endA, begInnerX, begInnerY, begOuterX, begOuterY, endInnerX, endInnerY, endOuterX, endOuterY, r) {
191
+ var f = endA - beginA > Math.PI ? 1 : 0, d = "M" + begInnerX + " " + begInnerY;
192
+ if (r < 0)
193
+ r = -r;
194
+ d +=
195
+ "A" + r1 + " " + r1 + " 0 " + f + " 1 " + endInnerX + " " + endInnerY;
196
+ if (config.arcEndCap == "round")
197
+ d += "A" + r + " " + r + " " + " 0 1 0 " + endOuterX + " " + endOuterY;
198
+ else if (config.arcEndCap == "-round")
199
+ d += "A" + r + " " + r + " " + " 0 1 1 " + endOuterX + " " + endOuterY;
200
+ else
201
+ d += "L" + endOuterX + " " + endOuterY;
202
+ d +=
203
+ "A" + r2 + " " + r2 + " 0 " + f + " 0 " + begOuterX + " " + begOuterY;
204
+ if (config.arcStartCap == "round")
205
+ d += "A" + r + " " + r + " " + " 0 1 0 " + begInnerX + " " + begInnerY;
206
+ else if (config.arcStartCap == "-round")
207
+ d += "A" + r + " " + r + " " + " 0 1 1 " + begInnerX + " " + begInnerY;
208
+ else
209
+ d += "L" + begInnerX + " " + begInnerY;
210
+ if (config.arcStartCap == "butt")
211
+ d += "Z";
212
+ setAttribute(el, "d", d);
213
+ });
214
214
  };
215
215
 
216
- function rotate (cx, cy, deg, x, y) {
217
- var cos = Math.cos(deg), sin = Math.sin(deg);
218
- return [
219
- (x - cx) * cos - (y - cy) * sin + cx,
220
- (x - cx) * sin + (y - cy) * cos + cy
221
- ];
216
+ function rotate (cx, cy, deg, x, y) {
217
+ var cos = Math.cos(deg), sin = Math.sin(deg);
218
+ return [
219
+ (x - cx) * cos - (y - cy) * sin + cx,
220
+ (x - cx) * sin + (y - cy) * cos + cy
221
+ ];
222
222
  }
223
223
 
224
- var oldAttrName = {
225
- "font-size": "fontSize",
226
- "font-family": "fontFamily",
227
- "arc-start-cap": "arcStartCap",
228
- "arc-end-cap": "arcEndCap",
229
- };
230
- var SVG$1 = (function () {
231
- function SVG(svg) {
232
- this.name = "SVG";
233
- this.__config = {
234
- fillStyle: "#000",
235
- strokeStyle: "#000",
236
- lineWidth: 1,
237
- textAlign: "left",
238
- textBaseline: "middle",
239
- "fontSize": 16,
240
- "fontFamily": "sans-serif",
241
- "arcStartCap": "butt",
242
- "arcEndCap": "butt",
243
- lineDash: [],
244
- };
245
- this.__path = "";
246
- this.__currentPosition = [];
247
- this.__svg = svg;
248
- }
249
- SVG.prototype.config = function (params) {
250
- if (typeof params !== "object") {
251
- return this.__config[oldAttrName[params] || params];
252
- }
253
- else {
254
- for (var key in params) {
255
- var _key = oldAttrName[key] || key;
256
- this.__config[_key] = params[key];
257
- }
258
- }
259
- return this;
260
- };
261
- SVG.prototype.useEl = function (el) {
262
- this.__useEl = el;
263
- return this;
264
- };
265
- SVG.prototype.getEl = function () {
266
- return this.__useEl;
267
- };
268
- SVG.prototype.appendEl = function (el, context) {
269
- context = context || this.__svg;
270
- if (typeof el == "string")
271
- el = toNode(el);
272
- context.appendChild(el);
273
- this.__useEl = el;
274
- return this;
275
- };
276
- SVG.prototype.appendBoard = function (el, context) {
277
- var _el = el;
278
- if (typeof el == "string")
279
- _el =
280
- {
281
- text: "text",
282
- path: "path",
283
- arc: "path",
284
- circle: "circle",
285
- rect: "rect",
286
- }[el] || "";
287
- if (_el == "")
288
- throw new Error("Unsupported drawing method:" + el);
289
- return this.appendEl(_el, context);
290
- };
291
- SVG.prototype.remove = function () {
292
- if (!this.__useEl) {
293
- throw new Error("Currently, no node can be deleted.");
294
- }
295
- else {
296
- this.__useEl.parentNode.removeChild(this.__useEl);
297
- }
298
- return this;
299
- };
300
- SVG.prototype.attr = function (params) {
301
- if (!this.__useEl)
302
- throw new Error("Currently, no node can be modified or viewed.");
303
- if (typeof params !== "object") {
304
- return getAttribute(this.__useEl, params);
305
- }
306
- else {
307
- for (var key in params) {
308
- setAttribute(this.__useEl, key, params[key]);
309
- }
310
- return this;
311
- }
312
- };
313
- SVG.prototype.fillText = function (text, x, y, deg) {
314
- if (deg === void 0) { deg = 0; }
315
- initText(this.__useEl, this.__config, x, y, deg);
316
- this.__useEl.textContent = text;
317
- fill(this.__useEl, this.__config);
318
- return this;
319
- };
320
- SVG.prototype.strokeText = function (text, x, y, deg) {
321
- if (deg === void 0) { deg = 0; }
322
- initText(this.__useEl, this.__config, x, y, deg);
323
- this.__useEl.textContent = text;
324
- stroke(this.__useEl, this.__config);
325
- return this;
326
- };
327
- SVG.prototype.fullText = function (text, x, y, deg) {
328
- if (deg === void 0) { deg = 0; }
329
- initText(this.__useEl, this.__config, x, y, deg);
330
- this.__useEl.textContent = text;
331
- full(this.__useEl, this.__config);
332
- return this;
333
- };
334
- SVG.prototype.fillArc = function (cx, cy, r1, r2, beginDeg, deg) {
335
- initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg);
336
- fill(this.__useEl, this.__config);
337
- return this;
338
- };
339
- SVG.prototype.strokeArc = function (cx, cy, r1, r2, beginDeg, deg) {
340
- initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg);
341
- stroke(this.__useEl, this.__config);
342
- return this;
343
- };
344
- SVG.prototype.fullArc = function (cx, cy, r1, r2, beginDeg, deg) {
345
- initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg);
346
- full(this.__useEl, this.__config);
347
- return this;
348
- };
349
- SVG.prototype.fillCircle = function (cx, cy, r) {
350
- initCircle(this.__useEl, cx, cy, r);
351
- fill(this.__useEl, this.__config);
352
- return this;
353
- };
354
- SVG.prototype.strokeCircle = function (cx, cy, r) {
355
- initCircle(this.__useEl, cx, cy, r);
356
- stroke(this.__useEl, this.__config);
357
- return this;
358
- };
359
- SVG.prototype.fullCircle = function (cx, cy, r) {
360
- initCircle(this.__useEl, cx, cy, r);
361
- full(this.__useEl, this.__config);
362
- return this;
363
- };
364
- SVG.prototype.fillRect = function (x, y, width, height) {
365
- initRect(this.__useEl, x, y, width, height);
366
- fill(this.__useEl, this.__config);
367
- return this;
368
- };
369
- SVG.prototype.strokeRect = function (x, y, width, height) {
370
- initRect(this.__useEl, x, y, width, height);
371
- stroke(this.__useEl, this.__config);
372
- return this;
373
- };
374
- SVG.prototype.fullRect = function (x, y, width, height) {
375
- initRect(this.__useEl, x, y, width, height);
376
- full(this.__useEl, this.__config);
377
- return this;
378
- };
379
- SVG.prototype.beginPath = function () {
380
- this.__currentPosition = [];
381
- this.__path = "";
382
- return this;
383
- };
384
- SVG.prototype.closePath = function () {
385
- this.__path += "Z";
386
- return this;
387
- };
388
- SVG.prototype.moveTo = function (x, y) {
389
- this.__currentPosition = [x, y];
390
- this.__path += "M" + x + " " + y;
391
- return this;
392
- };
393
- SVG.prototype.lineTo = function (x, y) {
394
- this.__currentPosition = [x, y];
395
- this.__path += (this.__path == "" ? "M" : "L") + x + " " + y;
396
- return this;
397
- };
398
- SVG.prototype.fill = function () {
399
- initPath(this.__useEl, this.__path);
400
- fill(this.__useEl, this.__config);
401
- return this;
402
- };
403
- SVG.prototype.stroke = function () {
404
- initPath(this.__useEl, this.__path);
405
- stroke(this.__useEl, this.__config);
406
- return this;
407
- };
408
- SVG.prototype.full = function () {
409
- initPath(this.__useEl, this.__path);
410
- full(this.__useEl, this.__config);
411
- return this;
412
- };
413
- SVG.prototype.arc = function (x, y, r, beginDeg, deg) {
414
- var begPosition = rotate(x, y, (beginDeg / 180) * Math.PI, x + r, y);
415
- var endPosition = rotate(x, y, ((beginDeg + deg) / 180) * Math.PI, x + r, y);
416
- if (this.__path == "") {
417
- this.__path += "M" + begPosition[0] + "," + begPosition[1];
418
- }
419
- else if (begPosition[0] != this.__currentPosition[0] ||
420
- begPosition[1] != this.__currentPosition[1]) {
421
- this.__path += "L" + begPosition[0] + "," + begPosition[1];
422
- }
423
- this.__path +=
424
- "A" +
425
- r +
426
- "," +
427
- r +
428
- " 0 " +
429
- (deg > 180 || deg < -180 ? 1 : 0) +
430
- "," +
431
- (deg > 0 ? 1 : 0) +
432
- " " +
433
- endPosition[0] +
434
- "," +
435
- endPosition[1];
436
- return this;
437
- };
438
- SVG.prototype.quadraticCurveTo = function (cpx, cpy, x, y) {
439
- this.__path += "Q" + cpx + " " + cpy + "," + x + " " + y;
440
- return this;
441
- };
442
- SVG.prototype.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {
443
- this.__path +=
444
- "C" + cp1x + " " + cp1y + "," + cp2x + " " + cp2y + "," + x + " " + y;
445
- return this;
446
- };
447
- SVG.prototype.bind = function (eventType, callback) {
448
- this.__useEl.addEventListener(eventType, function (event) {
449
- callback.call(this, event, this);
450
- }, false);
451
- return this;
452
- };
453
- return SVG;
224
+ var oldAttrName = {
225
+ "font-size": "fontSize",
226
+ "font-family": "fontFamily",
227
+ "arc-start-cap": "arcStartCap",
228
+ "arc-end-cap": "arcEndCap",
229
+ };
230
+ var SVG$1 = (function () {
231
+ function SVG(svg) {
232
+ this.name = "SVG";
233
+ this.__config = {
234
+ fillStyle: "#000",
235
+ strokeStyle: "#000",
236
+ lineWidth: 1,
237
+ textAlign: "left",
238
+ textBaseline: "middle",
239
+ "fontSize": 16,
240
+ "fontFamily": "sans-serif",
241
+ "arcStartCap": "butt",
242
+ "arcEndCap": "butt",
243
+ lineDash: [],
244
+ };
245
+ this.__path = "";
246
+ this.__currentPosition = [];
247
+ this.__svg = svg;
248
+ }
249
+ SVG.prototype.config = function (params) {
250
+ if (typeof params !== "object") {
251
+ return this.__config[oldAttrName[params] || params];
252
+ }
253
+ else {
254
+ for (var key in params) {
255
+ var _key = oldAttrName[key] || key;
256
+ this.__config[_key] = params[key];
257
+ }
258
+ }
259
+ return this;
260
+ };
261
+ SVG.prototype.useEl = function (el) {
262
+ this.__useEl = el;
263
+ return this;
264
+ };
265
+ SVG.prototype.getEl = function () {
266
+ return this.__useEl;
267
+ };
268
+ SVG.prototype.appendEl = function (el, context) {
269
+ context = context || this.__svg;
270
+ if (typeof el == "string")
271
+ el = toNode(el);
272
+ context.appendChild(el);
273
+ this.__useEl = el;
274
+ return this;
275
+ };
276
+ SVG.prototype.appendBoard = function (el, context) {
277
+ var _el = el;
278
+ if (typeof el == "string")
279
+ _el =
280
+ {
281
+ text: "text",
282
+ path: "path",
283
+ arc: "path",
284
+ circle: "circle",
285
+ rect: "rect",
286
+ }[el] || "";
287
+ if (_el == "")
288
+ throw new Error("Unsupported drawing method:" + el);
289
+ return this.appendEl(_el, context);
290
+ };
291
+ SVG.prototype.remove = function () {
292
+ if (!this.__useEl) {
293
+ throw new Error("Currently, no node can be deleted.");
294
+ }
295
+ else {
296
+ this.__useEl.parentNode.removeChild(this.__useEl);
297
+ }
298
+ return this;
299
+ };
300
+ SVG.prototype.attr = function (params) {
301
+ if (!this.__useEl)
302
+ throw new Error("Currently, no node can be modified or viewed.");
303
+ if (typeof params !== "object") {
304
+ return getAttribute(this.__useEl, params);
305
+ }
306
+ else {
307
+ for (var key in params) {
308
+ setAttribute(this.__useEl, key, params[key]);
309
+ }
310
+ return this;
311
+ }
312
+ };
313
+ SVG.prototype.fillText = function (text, x, y, deg) {
314
+ if (deg === void 0) { deg = 0; }
315
+ initText(this.__useEl, this.__config, x, y, deg);
316
+ this.__useEl.textContent = text;
317
+ fill(this.__useEl, this.__config);
318
+ return this;
319
+ };
320
+ SVG.prototype.strokeText = function (text, x, y, deg) {
321
+ if (deg === void 0) { deg = 0; }
322
+ initText(this.__useEl, this.__config, x, y, deg);
323
+ this.__useEl.textContent = text;
324
+ stroke(this.__useEl, this.__config);
325
+ return this;
326
+ };
327
+ SVG.prototype.fullText = function (text, x, y, deg) {
328
+ if (deg === void 0) { deg = 0; }
329
+ initText(this.__useEl, this.__config, x, y, deg);
330
+ this.__useEl.textContent = text;
331
+ full(this.__useEl, this.__config);
332
+ return this;
333
+ };
334
+ SVG.prototype.fillArc = function (cx, cy, r1, r2, beginDeg, deg) {
335
+ initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg);
336
+ fill(this.__useEl, this.__config);
337
+ return this;
338
+ };
339
+ SVG.prototype.strokeArc = function (cx, cy, r1, r2, beginDeg, deg) {
340
+ initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg);
341
+ stroke(this.__useEl, this.__config);
342
+ return this;
343
+ };
344
+ SVG.prototype.fullArc = function (cx, cy, r1, r2, beginDeg, deg) {
345
+ initArc(this.__useEl, this.__config, cx, cy, r1, r2, beginDeg, deg);
346
+ full(this.__useEl, this.__config);
347
+ return this;
348
+ };
349
+ SVG.prototype.fillCircle = function (cx, cy, r) {
350
+ initCircle(this.__useEl, cx, cy, r);
351
+ fill(this.__useEl, this.__config);
352
+ return this;
353
+ };
354
+ SVG.prototype.strokeCircle = function (cx, cy, r) {
355
+ initCircle(this.__useEl, cx, cy, r);
356
+ stroke(this.__useEl, this.__config);
357
+ return this;
358
+ };
359
+ SVG.prototype.fullCircle = function (cx, cy, r) {
360
+ initCircle(this.__useEl, cx, cy, r);
361
+ full(this.__useEl, this.__config);
362
+ return this;
363
+ };
364
+ SVG.prototype.fillRect = function (x, y, width, height) {
365
+ initRect(this.__useEl, x, y, width, height);
366
+ fill(this.__useEl, this.__config);
367
+ return this;
368
+ };
369
+ SVG.prototype.strokeRect = function (x, y, width, height) {
370
+ initRect(this.__useEl, x, y, width, height);
371
+ stroke(this.__useEl, this.__config);
372
+ return this;
373
+ };
374
+ SVG.prototype.fullRect = function (x, y, width, height) {
375
+ initRect(this.__useEl, x, y, width, height);
376
+ full(this.__useEl, this.__config);
377
+ return this;
378
+ };
379
+ SVG.prototype.beginPath = function () {
380
+ this.__currentPosition = [];
381
+ this.__path = "";
382
+ return this;
383
+ };
384
+ SVG.prototype.closePath = function () {
385
+ this.__path += "Z";
386
+ return this;
387
+ };
388
+ SVG.prototype.moveTo = function (x, y) {
389
+ this.__currentPosition = [x, y];
390
+ this.__path += "M" + x + " " + y;
391
+ return this;
392
+ };
393
+ SVG.prototype.lineTo = function (x, y) {
394
+ this.__currentPosition = [x, y];
395
+ this.__path += (this.__path == "" ? "M" : "L") + x + " " + y;
396
+ return this;
397
+ };
398
+ SVG.prototype.fill = function () {
399
+ initPath(this.__useEl, this.__path);
400
+ fill(this.__useEl, this.__config);
401
+ return this;
402
+ };
403
+ SVG.prototype.stroke = function () {
404
+ initPath(this.__useEl, this.__path);
405
+ stroke(this.__useEl, this.__config);
406
+ return this;
407
+ };
408
+ SVG.prototype.full = function () {
409
+ initPath(this.__useEl, this.__path);
410
+ full(this.__useEl, this.__config);
411
+ return this;
412
+ };
413
+ SVG.prototype.arc = function (x, y, r, beginDeg, deg) {
414
+ var begPosition = rotate(x, y, (beginDeg / 180) * Math.PI, x + r, y);
415
+ var endPosition = rotate(x, y, ((beginDeg + deg) / 180) * Math.PI, x + r, y);
416
+ if (this.__path == "") {
417
+ this.__path += "M" + begPosition[0] + "," + begPosition[1];
418
+ }
419
+ else if (begPosition[0] != this.__currentPosition[0] ||
420
+ begPosition[1] != this.__currentPosition[1]) {
421
+ this.__path += "L" + begPosition[0] + "," + begPosition[1];
422
+ }
423
+ this.__path +=
424
+ "A" +
425
+ r +
426
+ "," +
427
+ r +
428
+ " 0 " +
429
+ (deg > 180 || deg < -180 ? 1 : 0) +
430
+ "," +
431
+ (deg > 0 ? 1 : 0) +
432
+ " " +
433
+ endPosition[0] +
434
+ "," +
435
+ endPosition[1];
436
+ return this;
437
+ };
438
+ SVG.prototype.quadraticCurveTo = function (cpx, cpy, x, y) {
439
+ this.__path += "Q" + cpx + " " + cpy + "," + x + " " + y;
440
+ return this;
441
+ };
442
+ SVG.prototype.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {
443
+ this.__path +=
444
+ "C" + cp1x + " " + cp1y + "," + cp2x + " " + cp2y + "," + x + " " + y;
445
+ return this;
446
+ };
447
+ SVG.prototype.bind = function (eventType, callback) {
448
+ this.__useEl.addEventListener(eventType, function (event) {
449
+ callback.call(this, event, this);
450
+ }, false);
451
+ return this;
452
+ };
453
+ return SVG;
454
454
  }());
455
455
 
456
- var SVG = (function (_super) {
457
- __extends(SVG, _super);
458
- function SVG(el) {
459
- if (!el) {
460
- throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");
461
- }
462
- var width = el.clientWidth, height = el.clientHeight;
463
- var ViewSVG = document.createElementNS("http://www.w3.org/2000/svg", 'svg');
464
- el.appendChild(ViewSVG);
465
- ViewSVG.setAttribute("width", width + "");
466
- ViewSVG.setAttribute("height", height + "");
467
- ViewSVG.setAttribute("viewBox", "0 0 " + width + " " + height);
468
- return _super.call(this, ViewSVG) || this;
469
- }
470
- return SVG;
456
+ var SVG = (function (_super) {
457
+ __extends(SVG, _super);
458
+ function SVG(el) {
459
+ if (!el) {
460
+ throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");
461
+ }
462
+ var width = el.clientWidth, height = el.clientHeight;
463
+ var ViewSVG = document.createElementNS("http://www.w3.org/2000/svg", 'svg');
464
+ el.appendChild(ViewSVG);
465
+ ViewSVG.setAttribute("width", width + "");
466
+ ViewSVG.setAttribute("height", height + "");
467
+ ViewSVG.setAttribute("viewBox", "0 0 " + width + " " + height);
468
+ return _super.call(this, ViewSVG) || this;
469
+ }
470
+ return SVG;
471
471
  }(SVG$1));
472
472
 
473
473
  return SVG;