vislite 1.2.0-alpha.1 → 1.2.0-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 +5 -1
- package/README.md +165 -166
- package/lib/Buffer/index.es.js +1 -1
- package/lib/Buffer/index.es.min.js +1 -1
- package/lib/Canvas/index.es.js +5 -5
- 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/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/RawCanvas/index.es.js +1 -1
- package/lib/RawCanvas/index.es.min.js +1 -1
- package/lib/SVG/index.es.js +1 -1
- package/lib/SVG/index.es.min.js +1 -1
- 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 +6 -6
- package/lib/TreeLayout/index.es.min.js +1 -1
- package/lib/animation/index.es.js +1 -1
- package/lib/animation/index.es.min.js +1 -1
- package/lib/assemble/index.es.d.ts +3 -0
- package/lib/assemble/index.es.js +23 -0
- package/lib/assemble/index.es.min.d.ts +3 -0
- package/lib/assemble/index.es.min.js +5 -0
- 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 +48 -9
- package/lib/index.umd.min.js +2 -2
- package/lib/initOption/index.es.d.ts +3 -0
- package/lib/initOption/index.es.js +12 -0
- package/lib/initOption/index.es.min.d.ts +3 -0
- package/lib/initOption/index.es.min.js +5 -0
- package/lib/mergeOption/index.es.d.ts +3 -0
- package/lib/mergeOption/index.es.js +42 -0
- package/lib/mergeOption/index.es.min.d.ts +3 -0
- package/lib/mergeOption/index.es.min.js +5 -0
- 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 +5 -5
- package/lib/throttle/index.es.min.js +1 -1
- package/package/assemble/index.ts +3 -0
- package/package/index.ts +11 -1
- package/package/initOption/index.ts +3 -0
- package/package/mergeOption/index.ts +3 -0
- package/package.json +1 -1
- package/src/Canvas.ts +2 -2
- package/src/animation.ts +98 -98
- package/src/common/option.ts +30 -0
- package/src/common/tree/index.ts +2 -2
- package/src/common/type.ts +27 -0
- package/src/layout/TreeLayout.ts +2 -2
- package/src/throttle.ts +2 -2
- package/types/assemble.d.ts +6 -0
- package/types/index.d.ts +14 -1
- package/types/option.d.ts +13 -0
- package/src/common/mergeOption.ts +0 -7
package/CHANGELOG
CHANGED
package/README.md
CHANGED
|
@@ -1,166 +1,165 @@
|
|
|
1
|
-
- 💘 开源不易,去 <i>[Github给个Star](https://github.com/oi-contrib/VISLite) </i>吧!
|
|
2
|
-
|
|
3
|
-
<img src='https://oi-contrib.github.io/VISLite/images/logo.png' height='300px'/>
|
|
4
|
-
|
|
5
|
-
<p>
|
|
6
|
-
<a href="https://zxl20070701.github.io/toolbox/#/npm-download?packages=vislite&interval=7">
|
|
7
|
-
<img src="https://img.shields.io/npm/dm/vislite.svg" alt="downloads">
|
|
8
|
-
</a>
|
|
9
|
-
<a href="https://www.npmjs.com/package/vislite">
|
|
10
|
-
<img src="https://img.shields.io/npm/v/vislite.svg" alt="npm">
|
|
11
|
-
</a>
|
|
12
|
-
<a href="https://www.jsdelivr.com/package/npm/vislite">
|
|
13
|
-
<img src="https://data.jsdelivr.com/v1/package/npm/vislite/badge" alt="cdn">
|
|
14
|
-
</a>
|
|
15
|
-
<a href="https://github.com/oi-contrib/VISLite" target='_blank'>
|
|
16
|
-
<img alt="GitHub repo stars" src="https://img.shields.io/github/stars/oi-contrib/VISLite?style=social">
|
|
17
|
-
</a>
|
|
18
|
-
<a href="https://gitee.com/oi-contrib/VISLite" target='_blank'>
|
|
19
|
-
<img alt="Gitee repo stars" src="https://gitee.com/oi-contrib/VISLite/badge/star.svg?theme=dark">
|
|
20
|
-
</a>
|
|
21
|
-
</p>
|
|
22
|
-
|
|
23
|
-
<img src="https://nodei.co/npm/vislite.png?downloads=true&downloadRank=true&stars=true" alt="NPM">
|
|
24
|
-
|
|
25
|
-
# VISLite
|
|
26
|
-
|
|
27
|
-
```VISLite```是一个使用```TypeScript```开发的可视化库。官网地址:[https://oi-contrib.github.io/VISLite](https://oi-contrib.github.io/VISLite)
|
|
28
|
-
|
|
29
|
-
主要提供了跨端的画布和计算,开发人员只需要按照文档的描述就可以非常简单的完成包括Web、uni-app、微信小程序等平台的可视化开发,除了必要的初始化差异,主要的业务代码部分不同端完全一致。
|
|
30
|
-
|
|
31
|
-
## 简介
|
|
32
|
-
|
|
33
|
-
这是一个轻量级的数据可视化资源库,目标是:帮助你更快速、简单、高效的开发出任意的可视化业务产品。
|
|
34
|
-
|
|
35
|
-
> 本项目已在[开源中国](https://www.oschina.net/p/vislite)中开源,欢迎关注和留言。
|
|
36
|
-
|
|
37
|
-
### 常用的算法
|
|
38
|
-
|
|
39
|
-
我们通过提供可视化常用的算法来帮助你绘制复杂图表。比如下面的树图,通过简单的配置就可以把任意格式的数据变成任意绘制的带坐标的数据:
|
|
40
|
-
|
|
41
|
-
<img src="https://oi-contrib.github.io/VISLite/images/docs/what_1.png" width="400"/>
|
|
42
|
-
|
|
43
|
-
> 上述例子的运行地址:[从左到右树状图](https://oi-contrib.github.io/VISLite/#/example/canvas/tree-layout-lr)。
|
|
44
|
-
|
|
45
|
-
除了[树布局](https://oi-contrib.github.io/VISLite/#/api/treeLayout)外,我们还提供了:[刻度尺算法](https://oi-contrib.github.io/VISLite/#/api/ruler)来帮助你计算刻度应该如何确定、[等角斜方位投影](https://oi-contrib.github.io/VISLite/#/api/eoap)和[墨卡托投影](https://oi-contrib.github.io/VISLite/#/api/mercator)来绘制地图、[插值函数](https://oi-contrib.github.io/VISLite/#/api/cardinal)来完成折线变光滑的曲线、[变换矩阵](https://oi-contrib.github.io/VISLite/#/api/matrix4)提供各种坐标变换等。
|
|
46
|
-
|
|
47
|
-
### 画笔加强
|
|
48
|
-
|
|
49
|
-
我们对画笔进行了加强,使得其更简单好用。比如canvas,抽象出区域的概念,使得无论你绘制的图形多么的不规则,都可以很轻松的实现交互功能:
|
|
50
|
-
|
|
51
|
-
<img src="https://oi-contrib.github.io/VISLite/images/docs/what_2.png" width="400"/>
|
|
52
|
-
|
|
53
|
-
> 上述例子的运行地址:[中国地图](https://oi-contrib.github.io/VISLite/#/example/canvas/china)。
|
|
54
|
-
|
|
55
|
-
画笔除了像上面那样为了方便交互而补充区域的设计外,还对原来的API进行了一次抽象,使得API更友好简单```(比如WebGL,即使不会3D的人也可以轻松使用,而SVG的使用,你无需去记忆那些晦涩难懂的属性)```,同时,我们还抹平了不同版本浏览器等之间的差异。
|
|
56
|
-
|
|
57
|
-
### 支持跨端开发
|
|
58
|
-
|
|
59
|
-
除了Web端外,我们还针对uni-app、微信小程序等端进行了支持,并且不同端API保持一致,大大提高了代码的复用性:
|
|
60
|
-
|
|
61
|
-
<img src="https://oi-contrib.github.io/VISLite/images/docs/what_3.png" width="600"/>
|
|
62
|
-
|
|
63
|
-
> 上述例子的运行地址:[金额波浪球](https://oi-contrib.github.io/VISLite/#/example/svg/money-schedule)。
|
|
64
|
-
|
|
65
|
-
基于实际需要,我们目前对 ```Canvas``` 提供了跨端支持,除 ```Web端``` 外,还支持 ```原生微信小程序``` 和 ```uni-app端``` (编译成H5、微信小程序、支付宝小程序等) ,如果后续有必要,我们会对Canvas支持的端或SVG、WebGL等画笔进行更多端扩展。
|
|
66
|
-
|
|
67
|
-
## 特点
|
|
68
|
-
|
|
69
|
-
- 灵活的引入方式:包括npm安装后按照```ES Module```或```CommonJS```规范引入或直接使用script标签的```CDN```方式。
|
|
70
|
-
- 按需引入或全局引入:支持源码TS引入、按需JS引入或者全量引入等多种方式。
|
|
71
|
-
- 简单与复杂共存:一方面我们提供了可视化需要的基础功能,你可以按照自己的需要组合使用;另一方面,为了加速开发,我们针对常见的可视化业务场景进行了封装,可以帮助你快速完成,你可以根据实际情况进行选择。
|
|
72
|
-
- 向下兼容:我们向你保证,同一个大版本下始终向下兼容```(alpha和beta版本为测试版本,不包括)```,因此,无论何时,在同一个大版本号下,最新版本总是最好的选择。
|
|
73
|
-
|
|
74
|
-
> 版本说明:alpha为开发阶段、beta为发布前测试、rc为候选版本、next为未来版本、无后缀的为正式版本。
|
|
75
|
-
|
|
76
|
-
## 需求墙
|
|
77
|
-
|
|
78
|
-
我们的目标是不断完善丰富可视化功能,非常希望获得你宝贵的建议和批评,无论任何想法,都可以给我们[留言](https://github.com/oi-contrib/VISLite/issues)告诉我们。
|
|
79
|
-
|
|
80
|
-
你所提的任何建议我们都会在最长一周内进行反馈说明。
|
|
81
|
-
|
|
82
|
-
## 更新日志
|
|
83
|
-
|
|
84
|
-
详见[正式版更新日志](./CHANGELOG),我们会在每次发布完正式版本后更新其内容。
|
|
85
|
-
|
|
86
|
-
## 下一步
|
|
87
|
-
|
|
88
|
-
我们会在这里列出接下来的工作重心:
|
|
89
|
-
|
|
90
|
-
- 为加速开发,提供常用坐标系和布局
|
|
91
|
-
- 文档优化(提高可读性、丰富用例、补充教程)
|
|
92
|
-
|
|
93
|
-
给我们[留言](https://github.com/oi-contrib/VISLite/issues)告诉我们你希望快速扩展的功能,我们会优先你的建议考虑哦~
|
|
94
|
-
|
|
95
|
-
## 参与贡献
|
|
96
|
-
|
|
97
|
-
你可以选择下列一项或多项进行参与:
|
|
98
|
-
|
|
99
|
-
- 代码维护:由于新功能或一些BUG的出现,对代码进行维护和升级。
|
|
100
|
-
- 文档编辑:主要是接口文档和教程需要编辑,这很重要。
|
|
101
|
-
- 用例开发和测试:在项目的test文件夹下有一些测试,而在docs文档中存在一些例子需要补充。
|
|
102
|
-
- 参与讨论:主要是讨论未来如何发展,改造的方向等。
|
|
103
|
-
|
|
104
|
-
如果有意向加入我们,你可以通过提 [issue](https://github.com/oi-contrib/VISLite/issues) 和我们取到联系,请简单说明一下情况,我们会尽快回复。
|
|
105
|
-
|
|
106
|
-
你可以查看[VISLite 贡献指南](./.github/CONTRIBUTING.md)文件了解更多细节,查看[AUTHORS.txt](./AUTHORS.txt)了解所有的贡献者。
|
|
107
|
-
|
|
108
|
-
## 相关项目
|
|
109
|
-
|
|
110
|
-
| Project | Status | Download |Description |
|
|
111
|
-
|---------|--------|-------|------|
|
|
112
|
-
| [@vislite/canvas] | [![vislite-canvas-status]][vislite-canvas-package] |[![vislite-canvas-download-status]][vislite-canvas
|
|
113
|
-
| [@vislite/chart] | [![vislite-chart-status]][vislite-chart-package] |[![vislite-chart-download-status]][vislite-chart
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
[
|
|
117
|
-
[vislite-canvas-
|
|
118
|
-
[vislite-canvas-status]: https://img.shields.io/npm/
|
|
119
|
-
[vislite-canvas-download
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
[
|
|
123
|
-
[vislite-chart-
|
|
124
|
-
[vislite-chart-status]: https://img.shields.io/npm/
|
|
125
|
-
[vislite-chart-download
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
[
|
|
129
|
-
[
|
|
130
|
-
[
|
|
131
|
-
[
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
Copyright (c) [zxl20070701](https://zxl20070701.github.io/notebook/home.html) 走一步,再走一步
|
|
1
|
+
- 💘 开源不易,去 <i>[Github给个Star](https://github.com/oi-contrib/VISLite) </i>吧!
|
|
2
|
+
|
|
3
|
+
<img src='https://oi-contrib.github.io/VISLite/images/logo.png' height='300px'/>
|
|
4
|
+
|
|
5
|
+
<p>
|
|
6
|
+
<a href="https://zxl20070701.github.io/toolbox/#/npm-download?packages=vislite&interval=7">
|
|
7
|
+
<img src="https://img.shields.io/npm/dm/vislite.svg" alt="downloads">
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/vislite">
|
|
10
|
+
<img src="https://img.shields.io/npm/v/vislite.svg" alt="npm">
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://www.jsdelivr.com/package/npm/vislite">
|
|
13
|
+
<img src="https://data.jsdelivr.com/v1/package/npm/vislite/badge" alt="cdn">
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://github.com/oi-contrib/VISLite" target='_blank'>
|
|
16
|
+
<img alt="GitHub repo stars" src="https://img.shields.io/github/stars/oi-contrib/VISLite?style=social">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://gitee.com/oi-contrib/VISLite" target='_blank'>
|
|
19
|
+
<img alt="Gitee repo stars" src="https://gitee.com/oi-contrib/VISLite/badge/star.svg?theme=dark">
|
|
20
|
+
</a>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<img src="https://nodei.co/npm/vislite.png?downloads=true&downloadRank=true&stars=true" alt="NPM">
|
|
24
|
+
|
|
25
|
+
# VISLite
|
|
26
|
+
|
|
27
|
+
```VISLite```是一个使用```TypeScript```开发的可视化库。官网地址:[https://oi-contrib.github.io/VISLite](https://oi-contrib.github.io/VISLite)
|
|
28
|
+
|
|
29
|
+
主要提供了跨端的画布和计算,开发人员只需要按照文档的描述就可以非常简单的完成包括Web、uni-app、微信小程序等平台的可视化开发,除了必要的初始化差异,主要的业务代码部分不同端完全一致。
|
|
30
|
+
|
|
31
|
+
## 简介
|
|
32
|
+
|
|
33
|
+
这是一个轻量级的数据可视化资源库,目标是:帮助你更快速、简单、高效的开发出任意的可视化业务产品。
|
|
34
|
+
|
|
35
|
+
> 本项目已在[开源中国](https://www.oschina.net/p/vislite)中开源,欢迎关注和留言。
|
|
36
|
+
|
|
37
|
+
### 常用的算法
|
|
38
|
+
|
|
39
|
+
我们通过提供可视化常用的算法来帮助你绘制复杂图表。比如下面的树图,通过简单的配置就可以把任意格式的数据变成任意绘制的带坐标的数据:
|
|
40
|
+
|
|
41
|
+
<img src="https://oi-contrib.github.io/VISLite/images/docs/what_1.png" width="400"/>
|
|
42
|
+
|
|
43
|
+
> 上述例子的运行地址:[从左到右树状图](https://oi-contrib.github.io/VISLite/#/example/canvas/tree-layout-lr)。
|
|
44
|
+
|
|
45
|
+
除了[树布局](https://oi-contrib.github.io/VISLite/#/api/treeLayout)外,我们还提供了:[刻度尺算法](https://oi-contrib.github.io/VISLite/#/api/ruler)来帮助你计算刻度应该如何确定、[等角斜方位投影](https://oi-contrib.github.io/VISLite/#/api/eoap)和[墨卡托投影](https://oi-contrib.github.io/VISLite/#/api/mercator)来绘制地图、[插值函数](https://oi-contrib.github.io/VISLite/#/api/cardinal)来完成折线变光滑的曲线、[变换矩阵](https://oi-contrib.github.io/VISLite/#/api/matrix4)提供各种坐标变换等。
|
|
46
|
+
|
|
47
|
+
### 画笔加强
|
|
48
|
+
|
|
49
|
+
我们对画笔进行了加强,使得其更简单好用。比如canvas,抽象出区域的概念,使得无论你绘制的图形多么的不规则,都可以很轻松的实现交互功能:
|
|
50
|
+
|
|
51
|
+
<img src="https://oi-contrib.github.io/VISLite/images/docs/what_2.png" width="400"/>
|
|
52
|
+
|
|
53
|
+
> 上述例子的运行地址:[中国地图](https://oi-contrib.github.io/VISLite/#/example/canvas/china)。
|
|
54
|
+
|
|
55
|
+
画笔除了像上面那样为了方便交互而补充区域的设计外,还对原来的API进行了一次抽象,使得API更友好简单```(比如WebGL,即使不会3D的人也可以轻松使用,而SVG的使用,你无需去记忆那些晦涩难懂的属性)```,同时,我们还抹平了不同版本浏览器等之间的差异。
|
|
56
|
+
|
|
57
|
+
### 支持跨端开发
|
|
58
|
+
|
|
59
|
+
除了Web端外,我们还针对uni-app、微信小程序等端进行了支持,并且不同端API保持一致,大大提高了代码的复用性:
|
|
60
|
+
|
|
61
|
+
<img src="https://oi-contrib.github.io/VISLite/images/docs/what_3.png" width="600"/>
|
|
62
|
+
|
|
63
|
+
> 上述例子的运行地址:[金额波浪球](https://oi-contrib.github.io/VISLite/#/example/svg/money-schedule)。
|
|
64
|
+
|
|
65
|
+
基于实际需要,我们目前对 ```Canvas``` 提供了跨端支持,除 ```Web端``` 外,还支持 ```原生微信小程序``` 和 ```uni-app端``` (编译成H5、微信小程序、支付宝小程序等) ,如果后续有必要,我们会对Canvas支持的端或SVG、WebGL等画笔进行更多端扩展。
|
|
66
|
+
|
|
67
|
+
## 特点
|
|
68
|
+
|
|
69
|
+
- 灵活的引入方式:包括npm安装后按照```ES Module```或```CommonJS```规范引入或直接使用script标签的```CDN```方式。
|
|
70
|
+
- 按需引入或全局引入:支持源码TS引入、按需JS引入或者全量引入等多种方式。
|
|
71
|
+
- 简单与复杂共存:一方面我们提供了可视化需要的基础功能,你可以按照自己的需要组合使用;另一方面,为了加速开发,我们针对常见的可视化业务场景进行了封装,可以帮助你快速完成,你可以根据实际情况进行选择。
|
|
72
|
+
- 向下兼容:我们向你保证,同一个大版本下始终向下兼容```(alpha和beta版本为测试版本,不包括)```,因此,无论何时,在同一个大版本号下,最新版本总是最好的选择。
|
|
73
|
+
|
|
74
|
+
> 版本说明:alpha为开发阶段、beta为发布前测试、rc为候选版本、next为未来版本、无后缀的为正式版本。
|
|
75
|
+
|
|
76
|
+
## 需求墙
|
|
77
|
+
|
|
78
|
+
我们的目标是不断完善丰富可视化功能,非常希望获得你宝贵的建议和批评,无论任何想法,都可以给我们[留言](https://github.com/oi-contrib/VISLite/issues)告诉我们。
|
|
79
|
+
|
|
80
|
+
你所提的任何建议我们都会在最长一周内进行反馈说明。
|
|
81
|
+
|
|
82
|
+
## 更新日志
|
|
83
|
+
|
|
84
|
+
详见[正式版更新日志](./CHANGELOG),我们会在每次发布完正式版本后更新其内容。
|
|
85
|
+
|
|
86
|
+
## 下一步
|
|
87
|
+
|
|
88
|
+
我们会在这里列出接下来的工作重心:
|
|
89
|
+
|
|
90
|
+
- 为加速开发,提供常用坐标系和布局
|
|
91
|
+
- 文档优化(提高可读性、丰富用例、补充教程)
|
|
92
|
+
|
|
93
|
+
给我们[留言](https://github.com/oi-contrib/VISLite/issues)告诉我们你希望快速扩展的功能,我们会优先你的建议考虑哦~
|
|
94
|
+
|
|
95
|
+
## 参与贡献
|
|
96
|
+
|
|
97
|
+
你可以选择下列一项或多项进行参与:
|
|
98
|
+
|
|
99
|
+
- 代码维护:由于新功能或一些BUG的出现,对代码进行维护和升级。
|
|
100
|
+
- 文档编辑:主要是接口文档和教程需要编辑,这很重要。
|
|
101
|
+
- 用例开发和测试:在项目的test文件夹下有一些测试,而在docs文档中存在一些例子需要补充。
|
|
102
|
+
- 参与讨论:主要是讨论未来如何发展,改造的方向等。
|
|
103
|
+
|
|
104
|
+
如果有意向加入我们,你可以通过提 [issue](https://github.com/oi-contrib/VISLite/issues) 和我们取到联系,请简单说明一下情况,我们会尽快回复。
|
|
105
|
+
|
|
106
|
+
你可以查看[VISLite 贡献指南](./.github/CONTRIBUTING.md)文件了解更多细节,查看[AUTHORS.txt](./AUTHORS.txt)了解所有的贡献者。
|
|
107
|
+
|
|
108
|
+
## 相关项目
|
|
109
|
+
|
|
110
|
+
| Project | Status | Download |Description |
|
|
111
|
+
|---------|--------|-------|------|
|
|
112
|
+
| [@vislite/canvas] | [![vislite-canvas-status]][vislite-canvas-package] |[![vislite-canvas-download-status]][vislite-canvas-download] | 基于VISLite的Canvas画笔开发的绘制方法 |
|
|
113
|
+
| [@vislite/chart] | [![vislite-chart-status]][vislite-chart-package] |[![vislite-chart-download-status]][vislite-chart-download] | 基于VISLite开发的可视化图表库(基础布局版本可跨端,类似ECharts) |
|
|
114
|
+
|
|
115
|
+
[@vislite/canvas]: https://github.com/oi-contrib/vislite-plugin-canvas
|
|
116
|
+
[vislite-canvas-package]: https://npmjs.com/package/@vislite/canvas
|
|
117
|
+
[vislite-canvas-status]: https://img.shields.io/npm/v/@vislite/canvas.svg
|
|
118
|
+
[vislite-canvas-download-status]: https://img.shields.io/npm/dm/@vislite/canvas.svg
|
|
119
|
+
[vislite-canvas-download]: https://zxl20070701.github.io/toolbox/#/npm-download?packages=@vislite/canvas&interval=7
|
|
120
|
+
|
|
121
|
+
[@vislite/chart]: https://github.com/oi-contrib/vislite-plugin-chart
|
|
122
|
+
[vislite-chart-package]: https://npmjs.com/package/@vislite/chart
|
|
123
|
+
[vislite-chart-status]: https://img.shields.io/npm/v/@vislite/chart.svg
|
|
124
|
+
[vislite-chart-download-status]: https://img.shields.io/npm/dm/@vislite/chart.svg
|
|
125
|
+
[vislite-chart-download]: https://zxl20070701.github.io/toolbox/#/npm-download?packages=@vislite/chart&interval=7
|
|
126
|
+
|
|
127
|
+
[H5Charts]: https://github.com/oi-contrib/H5Charts
|
|
128
|
+
[h5charts-package]: https://npmjs.com/package/h5charts
|
|
129
|
+
[h5charts-status]: https://img.shields.io/npm/v/h5charts.svg
|
|
130
|
+
[h5charts-download-status]: https://img.shields.io/npm/dm/h5charts.svg
|
|
131
|
+
[h5charts-download]: https://zxl20070701.github.io/toolbox/#/npm-download?packages=h5charts&interval=7
|
|
132
|
+
|
|
133
|
+
此外,我们还基于此项目维护了一个用例项目[dataGUI](https://github.com/oi-contrib/dataGUI),比如:
|
|
134
|
+
|
|
135
|
+
### 水分子式 H2O
|
|
136
|
+
|
|
137
|
+
<a href="https://oi-contrib.github.io/dataGUI/#/h2o" target="_blank">
|
|
138
|
+
<img src="https://oi-contrib.github.io/dataGUI/snipping/h2o.png">
|
|
139
|
+
</a>
|
|
140
|
+
|
|
141
|
+
### 手式解锁
|
|
142
|
+
|
|
143
|
+
<a href="https://oi-contrib.github.io/dataGUI/#/manual-unlocking" target="_blank">
|
|
144
|
+
<img src="https://oi-contrib.github.io/dataGUI/snipping/manual-unlocking.jpeg">
|
|
145
|
+
</a>
|
|
146
|
+
|
|
147
|
+
### 3D环图
|
|
148
|
+
|
|
149
|
+
<a href="https://oi-contrib.github.io/dataGUI/#/ring3d" target="_blank">
|
|
150
|
+
<img src="https://oi-contrib.github.io/dataGUI/snipping/ring3d.jpeg">
|
|
151
|
+
</a>
|
|
152
|
+
|
|
153
|
+
### 可视化大屏
|
|
154
|
+
|
|
155
|
+
<a href="https://oi-contrib.github.io/dataGUI/#/bigview" target="_blank">
|
|
156
|
+
<img src="https://oi-contrib.github.io/dataGUI/snipping/bigview.jpeg">
|
|
157
|
+
</a>
|
|
158
|
+
|
|
159
|
+
> 更多内容,你可以直接访问: [https://oi-contrib.github.io/dataGUI](https://oi-contrib.github.io/dataGUI)
|
|
160
|
+
|
|
161
|
+
## 版权
|
|
162
|
+
|
|
163
|
+
MIT License
|
|
164
|
+
|
|
165
|
+
Copyright (c) [zxl20070701](https://zxl20070701.github.io/notebook/home.html) 走一步,再走一步
|
package/lib/Buffer/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Buffer of VISLite JavaScript Library v1.2.0-alpha.
|
|
2
|
+
* Buffer of VISLite JavaScript Library v1.2.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
var t=function(){function t(t,i){void 0===i&&(i=!1),this.__painter=t,this.__isElement=i,this.__buffer=function(t){return t.createBuffer()}(t),this.__type=i?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER}return t.prototype.use=function(){return this.__painter.bindBuffer(this.__type,this.__buffer),this},t.prototype.write=function(t){return function(t,i,e,_){var r=e?t.ELEMENT_ARRAY_BUFFER:t.ARRAY_BUFFER;t.bufferData(r,i,_)}(this.__painter,t,this.__isElement,this.__painter.STATIC_DRAW),this.__fsize=t.BYTES_PER_ELEMENT,this},t.prototype.divide=function(t,i,e,_){return void 0===_&&(_=0),function(t,i,e,_,r,n,s){t.vertexAttribPointer(i,e,_,s,r,n),t.enableVertexAttribArray(i)}(this.__painter,t,i,this.__painter.FLOAT,e*this.__fsize,_*this.__fsize,!1),this},t}();export{t as default};
|
package/lib/Canvas/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Canvas of VISLite JavaScript Library v1.2.0-alpha.
|
|
2
|
+
* Canvas of VISLite JavaScript Library v1.2.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
/******************************************************************************
|
|
@@ -702,9 +702,9 @@ var Canvas$1 = (function (_super) {
|
|
|
702
702
|
return Canvas;
|
|
703
703
|
}(Painter));
|
|
704
704
|
|
|
705
|
-
function
|
|
706
|
-
for (var key in
|
|
707
|
-
defaultOption[key] =
|
|
705
|
+
function initOption(setOption, defaultOption) {
|
|
706
|
+
for (var key in setOption) {
|
|
707
|
+
defaultOption[key] = setOption[key];
|
|
708
708
|
}
|
|
709
709
|
return defaultOption;
|
|
710
710
|
}
|
|
@@ -719,7 +719,7 @@ var Canvas = (function (_super) {
|
|
|
719
719
|
if (!el) {
|
|
720
720
|
throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");
|
|
721
721
|
}
|
|
722
|
-
option =
|
|
722
|
+
option = initOption(option, {
|
|
723
723
|
region: true,
|
|
724
724
|
willReadFrequently: false
|
|
725
725
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Canvas of VISLite JavaScript Library v1.2.0-alpha.
|
|
2
|
+
* Canvas of VISLite JavaScript Library v1.2.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
var t=function(i,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])},t(i,e)};function i(i,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=i}t(i,e),i.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}"function"==typeof SuppressedError&&SuppressedError;var e=function(t,i,e,n,r){var o=Math.cos(e),s=Math.sin(e);return[+((n-t)*o-(r-i)*s+t).toFixed(7),+((n-t)*s+(r-i)*o+i).toFixed(7)]};var n=function(t,i,e,n,r){return t.beginPath(),t.translate(e,n),t.rotate(r),t.font=i.fontStyle+" "+i.fontWeight+" "+i.fontSize+"px "+i.fontFamily,t},r=function(t,i,n,r,o,s,_,h){if(o>s){var a=o;o=s,s=a}return _%=2*Math.PI,h>=1.999999*Math.PI||h<=1.999999*-Math.PI?h=2*Math.PI:h%=2*Math.PI,function(t,i,n,r,o,s,_){i<0&&(t+=i,i*=-1);var h,a=[];h=e(0,0,t,o,0),a[0]=h[0],a[1]=h[1],h=e(0,0,i,h[0],h[1]),a[2]=h[0],a[3]=h[1],h=e(0,0,t,s,0),a[4]=h[0],a[5]=h[1],h=e(0,0,i,h[0],h[1]),a[6]=h[0],a[7]=h[1],_(t,t+i,a[0]+n,a[1]+r,a[4]+n,a[5]+r,a[2]+n,a[3]+r,a[6]+n,a[7]+r,.5*(s-o))}(_,h,n,r,o,s,(function(e,_,h,a,l,u,p,f,c,g,y){y<0&&(y=-y),t.beginPath(),t.moveTo(h,a),t.arc(n,r,o,e,_,!1),"round"==i.arcEndCap?t.arc(.5*(p+c),.5*(f+g),y,_-Math.PI,_,!0):"-round"==i.arcEndCap?t.arc(.5*(p+c),.5*(f+g),y,_-Math.PI,_,!1):t.lineTo(c,g),t.arc(n,r,s,_,e,!0),"round"==i.arcStartCap?t.arc(.5*(h+l),.5*(a+u),y,e,e-Math.PI,!0):"-round"==i.arcStartCap?t.arc(.5*(h+l),.5*(a+u),y,e,e-Math.PI,!1):t.lineTo(h,a)})),"butt"==i.arcStartCap&&t.closePath(),t},o=function(t,i,e,n){return t.beginPath(),t.moveTo(i+n,e),t.arc(i,e,n,0,2*Math.PI),t},s=function(t,i,e,n,r){return t.beginPath(),t.rect(i,e,n,r),t};function _(t,i,e,n,r){for(var o=0,s="",_=0;_<i.length;_++)t.measureText(s+i[_]).width>e||/\n$/.test(s)?(r(s,((o+=1)-.5)*n),s=i[_]):_==i.length-1?(o+=1,r(s+i[_],(o-.5)*n)):s+=i[_];return o*n}var h=function(){function t(t,i,e,n,r){void 0===i&&(i={}),void 0===n&&(n=!1),this.__region=null,this.__onlyRegion=!1,this.__onlyView=!1,this.__specialConfig={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt"},this.__initConfig={fillStyle:"black",strokeStyle:"black",lineWidth:1,textAlign:"left",textBaseline:"middle",lineDash:[],shadowBlur:0,shadowColor:"black"},this.painter=t.getContext("2d",i),this.__region=e,this.__isPainter=n,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,i){if(this.__region&&!this.__onlyView&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,i),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(i);else if(t in this.__specialConfig)"fontSize"==t&&(i=Math.round(i)),this.__specialConfig[t]=i;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=i}return this},t.prototype.fillText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&!this.__onlyView&&this.__region.fillText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r).fillText(t,0,0),this.painter.restore()),this},t.prototype.strokeText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&!this.__onlyView&&this.__region.strokeText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r).strokeText(t,0,0),this.painter.restore()),this},t.prototype.fullText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&!this.__onlyView&&this.__region.fullText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore()),this},t.prototype.fillTexts=function(t,i,e,r,o,s){var h=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var a=0;if(this.__region&&!this.__onlyView&&(a=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return a;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=_(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){h.painter.fillText(t,0,i)}));return this.painter.restore(),l},t.prototype.strokeTexts=function(t,i,e,r,o,s){var h=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var a=0;if(this.__region&&!this.__onlyView&&(a=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return a;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=_(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){h.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.fullTexts=function(t,i,e,r,o,s){var h=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var a=0;if(this.__region&&!this.__onlyView&&(a=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return a;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=_(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){h.painter.fillText(t,0,i),h.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.beginPath=function(){return this.__region&&!this.__onlyView&&this.__region.beginPath(),this.__isPainter&&this.__onlyRegion||this.painter.beginPath(),this},t.prototype.closePath=function(){return this.__region&&!this.__onlyView&&this.__region.closePath(),this.__isPainter&&this.__onlyRegion||this.painter.closePath(),this},t.prototype.moveTo=function(t,i){return this.__region&&!this.__onlyView&&this.__region.moveTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.moveTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.lineTo=function(t,i){return this.__region&&!this.__onlyView&&this.__region.lineTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.lineTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.arc=function(t,i,e,n,r){return this.__region&&!this.__onlyView&&this.__region.arc(t,i,e,n,r),this.__isPainter&&this.__onlyRegion||this.painter.arc(t,i,e,n,n+r,r<0),this},t.prototype.fill=function(){return this.__region&&!this.__onlyView&&this.__region.fill(),this.__isPainter&&this.__onlyRegion||this.painter.fill(),this},t.prototype.stroke=function(){return this.__region&&!this.__onlyView&&this.__region.stroke(),this.__isPainter&&this.__onlyRegion||this.painter.stroke(),this},t.prototype.full=function(){return this.__region&&!this.__onlyView&&this.__region.full(),this.__isPainter&&this.__onlyRegion||(this.painter.fill(),this.painter.stroke()),this},t.prototype.save=function(){return this.__region&&!this.__onlyView&&this.__region.save(),this.__isPainter&&this.__onlyRegion||this.painter.save(),this},t.prototype.restore=function(){return this.__region&&!this.__onlyView&&this.__region.restore(),this.__isPainter&&this.__onlyRegion||this.painter.restore(),this},t.prototype.clip=function(){return this.__region&&!this.__onlyView&&this.__region.clip(),this.__isPainter&&this.__onlyRegion||this.painter.clip(),this},t.prototype.quadraticCurveTo=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.quadraticCurveTo(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.quadraticCurveTo(t,i,e,n),this},t.prototype.bezierCurveTo=function(t,i,e,n,r,o){return this.__region&&!this.__onlyView&&this.__region.bezierCurveTo(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||this.painter.bezierCurveTo(t,i,e,n,r,o),this},t.prototype.clearRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.clearRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.clearRect(t,i,e,n),this},t.prototype.fillArc=function(t,i,e,n,o,s){return this.__region&&!this.__onlyView&&this.__region.fillArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||r(this.painter,this.__specialConfig,t,i,e,n,o,s).fill(),this},t.prototype.strokeArc=function(t,i,e,n,o,s){return this.__region&&!this.__onlyView&&this.__region.strokeArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||r(this.painter,this.__specialConfig,t,i,e,n,o,s).stroke(),this},t.prototype.fullArc=function(t,i,e,n,o,s){return this.__region&&!this.__onlyView&&this.__region.fullArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||(r(this.painter,this.__specialConfig,t,i,e,n,o,s),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillCircle=function(t,i,e){return this.__region&&!this.__onlyView&&this.__region.fillCircle(t,i,e),this.__isPainter&&this.__onlyRegion||o(this.painter,t,i,e).fill(),this},t.prototype.strokeCircle=function(t,i,e){return this.__region&&!this.__onlyView&&this.__region.strokeCircle(t,i,e),this.__isPainter&&this.__onlyRegion||o(this.painter,t,i,e).stroke(),this},t.prototype.fullCircle=function(t,i,e){return this.__region&&!this.__onlyView&&this.__region.fullCircle(t,i,e),this.__isPainter&&this.__onlyRegion||(o(this.painter,t,i,e),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.fillRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||s(this.painter,t,i,e,n).fill(),this},t.prototype.strokeRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.strokeRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||s(this.painter,t,i,e,n).stroke(),this},t.prototype.fullRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.fullRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||(s(this.painter,t,i,e,n),this.painter.fill(),this.painter.stroke()),this},t.prototype.draw=function(){return Promise.resolve()},t.prototype.drawImage=function(t,i,e,n,r,o){var s=this;return void 0===o&&(o=!1),new Promise((function(_){if(s.__region&&!s.__onlyView&&s.__region.fillRect(i,e,n,r),s.__isPainter&&s.__onlyRegion)_({});else if("string"!=typeof t||o)s.painter.drawImage(t,0,0,n,r,i,e,n,r),_({});else{var h=new Image;h.onload=function(){s.painter.drawImage(h,0,0,h.width,h.height,i,e,n,r),_({})},h.src=t}}))},t.prototype.install=function(t){var i=this,e=function(e){if(e in n)throw new Error("VISLite Canvas:Method already exists and cannot be overwritten.");n[e]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=t[e].apply(i,n);return null!=o?o:i}},n=this;for(var r in t)e(r);return this},t}();var a=function(t){var i={value:function(){return t},setColor:function(e,n){return t.addColorStop(e,n),i}};return i},l=function(t){function e(i,e,n,r){void 0===n&&(n={}),void 0===r&&(r=1);var o=t.call(this,i,n,e?new h(e,{willReadFrequently:!0}):void 0,!0,r)||this;return o.name="Canvas",o.__regionList={},o.__regionAssemble=function(t,i,e,n){for(var r=[],o=0;o<n;o++)r[o]=t;return function(){for(var o=0;o<n;o++){if(r[o]+e<i){r[o]=+(r[o]+e).toFixed(7);break}o<n-1&&(r[o]=t)}return r}}(0,255,10,3),o.__scaleSize=r,o.setRegion(""),o}return i(e,t),e.prototype.config=function(t){for(var i in t)this.useConfig(i,t[i]);return this},e.prototype.onlyRegion=function(t){return this.__onlyRegion=t,this},e.prototype.onlyView=function(t){return this.__onlyView=t,this},e.prototype.setRegion=function(t){if(this.__region)if(t){if(null==this.__regionList[t]){var i=this.__regionAssemble();this.__regionList[t]="rgb("+i[0]+","+i[1]+","+i[2]+")"}this.__region.useConfig("fillStyle",this.__regionList[t])&&this.__region.useConfig("strokeStyle",this.__regionList[t])}else this.__region.useConfig("fillStyle","#000000")&&this.__region.useConfig("strokeStyle","#000000");return this},e.prototype.getRegion=function(t,i){var e=this;return new Promise((function(n){var r=e.__region?e.__region.painter.getImageData(t-.5,i-.5,1,1):{data:[0,0,0,0]},o=r.data,s=function(){if(e.__region)for(var t in e.__regionList)if("rgb("+o[0]+","+o[1]+","+o[2]+")"==e.__regionList[t]){n(t);break}n("")};o?s():r.then((function(t){o=t,s()}))}))},e.prototype.textWidth=function(t){this.painter.save(),n(this.painter,this.__specialConfig,0,0,0);var i=this.painter.measureText(t+"").width;return this.painter.restore(),i},e.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region?this.__region.painter:null:this.painter},e.prototype.getInfo=function(){return{width:this.painter.canvas.width/this.__scaleSize,height:this.painter.canvas.height/this.__scaleSize}},e.prototype.createLinearGradient=function(t,i,e,n){return function(t,i,e,n,r){var o=t.createLinearGradient(i,e,n,r);return a(o)}(this.painter,t,i,e,n)},e.prototype.createRadialGradient=function(t,i,e){return function(t,i,e,n){var r=t.createRadialGradient(i,e,0,i,e,n);return a(r)}(this.painter,t,i,e)},e.prototype.getColor=function(t,i){t*=this.__scaleSize,i*=this.__scaleSize;var e=this.painter.getImageData(t-.5,i-.5,1,1).data;return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},e}(h);var u=function(t){function e(i,e,n,r){void 0===e&&(e={}),void 0===n&&(n=0),void 0===r&&(r=0);var o=this;if(!i)throw new Error("VISLite Canvas:The mount point requires an HTMLElement type but encountered null.");e=function(t,i){for(var e in t)i[e]=t[e];return i}(e,{region:!0,willReadFrequently:!1}),n=n||i.clientWidth,r=r||i.clientHeight;var s,_=null,h=i;h._vislite_canvas_?(s=h._vislite_canvas_[0],_=h._vislite_canvas_[1]):(s=document.createElement("canvas"),i.appendChild(s),e.region&&(_=document.createElement("canvas")),h._vislite_canvas_=[s,_],i.setAttribute("vislite","Canvas"));for(var a=[_,s],l=0;l<a.length;l++){var u=a[l];u&&(u.style.width=n+"px",u.setAttribute("width",l*n+n+""),u.style.height=r+"px",u.setAttribute("height",l*r+r+""))}return(o=t.call(this,s,_,{willReadFrequently:e.willReadFrequently},2)||this).__canvas=s,o.__el=i,o.painter.scale(2,2),o}return i(e,t),e.prototype.toDataURL=function(){var t=this;return new Promise((function(i){i(t.__canvas.toDataURL())}))},e.prototype.bind=function(t,i){var e=this;return this.__el.addEventListener(t,(function(t){e.getRegion(t.offsetX,t.offsetY).then((function(t){i(t)}))})),this},e}(l);export{u as default};
|
package/lib/Cardinal/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Cardinal of VISLite JavaScript Library v1.2.0-alpha.
|
|
2
|
+
* Cardinal of VISLite JavaScript Library v1.2.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
var t=function(){function t(t){void 0===t&&(t=.5),this.name="Hermite",this.__u=t}return t.prototype.setP=function(t,i,_,h,s,e){if(!(t<_))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=_;var n=this.__u*s,o=this.__u*e;return i/=_-t,h/=_-t,this.__MR=[2*i-2*h+n+o,3*h-3*i-2*n-o,n,i],this},t.prototype.use=function(t){if(this.__MR){var i=(t-this.__a)/(this.__b-this.__a),_=i*i;return(i*_*this.__MR[0]+_*this.__MR[1]+i*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}(),i=function(){function i(t){void 0===t&&(t=0),this.name="Cardinal",this.__t=t}return i.prototype.setP=function(i){this.__HS={x:[],h:[]};var _,h,s=(i[1][1]-i[0][1])/(i[1][0]-i[0][0]);for(this.__HS.x[0]=i[0][0],_=1;_<i.length;_++){if(i[_][0]<=i[_-1][0])throw new Error("The point position should be increamented!");this.__HS.x[_]=i[_][0],h=_<i.length-1?i[_+1][1]>i[_][1]&&i[_-1][1]>i[_][1]||i[_+1][1]<i[_][1]&&i[_-1][1]<i[_][1]||i[_+1][1]==i[_][1]||i[_-1][1]==i[_][1]?0:(i[_+1][1]-i[_-1][1])/(i[_+1][0]-i[_-1][0]):(i[_][1]-i[_-1][1])/(i[_][0]-i[_-1][0]),this.__HS.h[_-1]=new t(.5*(1-this.__t)).setP(i[_-1][0],i[_-1][1],i[_][0],i[_][1],s,h),s=h}return this},i.prototype.use=function(t){if(this.__HS){for(this.__i=-1;this.__i+1<this.__HS.x.length&&(t>this.__HS.x[this.__i+1]||-1==this.__i&&t>=this.__HS.x[this.__i+1]);)this.__i+=1;return this.__i<0?this.__HS.h[0].use(this.__HS.x[0]):this.__i>=this.__HS.h.length?this.__HS.h[this.__HS.h.length-1].use(this.__HS.x[this.__HS.x.length-1]):this.__HS.h[this.__i].use(t)}throw new Error("You shoud first set the position!")},i}();export{i as default};
|
package/lib/Eoap/index.es.js
CHANGED
package/lib/Eoap/index.es.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Eoap of VISLite JavaScript Library v1.2.0-alpha.
|
|
2
|
+
* Eoap of VISLite JavaScript Library v1.2.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
var t=function(t,n,a,e){var r=Math.cos(t),h=Math.sin(t);return[n*r-a*h,n*h+a*r,e]},n=function(){function n(t,n){void 0===t&&(t=7),void 0===n&&(n=[107,36]),this.name="Eoap",this.__scale=t,this.__center=n}return n.prototype.use=function(n,a){var e,r,h,i,s,o,c=(e=(360-a)/180*Math.PI,r=100*this.__scale,h=0,i=0,s=Math.cos(e),o=Math.sin(e),[i*o+r*s,h,i*s-r*o]);return c=t(n/180*Math.PI,c[0],c[1],c[2]),c=t((90-this.__center[0])/180*Math.PI,c[0],c[1],c[2]),c=function(t,n,a,e){var r=Math.cos(t),h=Math.sin(t);return[n,a*r-e*h,a*h+e*r]}((90-this.__center[1])/180*Math.PI,c[0],c[1],c[2]),[-c[0],c[1],c[2]]},n}();export{n as default};
|
package/lib/Hermite/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Hermite of VISLite JavaScript Library v1.2.0-alpha.
|
|
2
|
+
* Hermite of VISLite JavaScript Library v1.2.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
var t=function(){function t(t){void 0===t&&(t=.5),this.name="Hermite",this.__u=t}return t.prototype.setP=function(t,i,_,s,h,r){if(!(t<_))throw new Error("The point x-position should be increamented!");this.__a=t,this.__b=_;var o=this.__u*h,e=this.__u*r;return i/=_-t,s/=_-t,this.__MR=[2*i-2*s+o+e,3*s-3*i-2*o-e,o,i],this},t.prototype.use=function(t){if(this.__MR){var i=(t-this.__a)/(this.__b-this.__a),_=i*i;return(i*_*this.__MR[0]+_*this.__MR[1]+i*this.__MR[2]+this.__MR[3])*(this.__b-this.__a)}throw new Error("You shoud first set the position!")},t}();export{t as default};
|
package/lib/Matrix4/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Matrix4 of VISLite JavaScript Library v1.2.0-alpha.
|
|
2
|
+
* Matrix4 of VISLite JavaScript Library v1.2.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
var t=function(t,r){for(var i=[],o=0;o<4;o++)for(var n=0;n<r.length/4;n++)i[4*n+o]=t[o]*r[4*n]+t[o+4]*r[4*n+1]+t[o+8]*r[4*n+2]+t[o+12]*r[4*n+3];return i},r=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],i=function(){function i(t){void 0===t&&(t=r),this.name="Matrix4",this.__matrix4=t}return i.prototype.setValue=function(t){return void 0===t&&(t=r),this.__matrix4=t,this},i.prototype.move=function(r,i,o,n){return void 0===n&&(n=0),this.__matrix4=t(function(t,r,i,o){void 0===o&&(o=0);var n=Math.sqrt(r*r+i*i+o*o);return[1,0,0,0,0,1,0,0,0,0,1,0,r*t/n,i*t/n,o*t/n,1]}(r,i,o,n),this.__matrix4),this},i.prototype.rotate=function(r,i,o,n,e,u,a){var s=function(t,r,i,o,n,e){if("number"==typeof t&&"number"==typeof r){if("number"!=typeof i?(i=0,o=t,n=r,e=1):"number"==typeof o&&"number"==typeof n&&"number"==typeof e||(o=t,n=r,e=i,t=0,r=0,i=0),t==o&&r==n&&i==e)throw new Error("It's not a legitimate ray!");var u=Math.sqrt((o-t)*(o-t)+(n-r)*(n-r)),a=0!=u?(n-r)/u:1,s=0!=u?(o-t)/u:0,h=(o-t)*s+(n-r)*a,_=e-i,f=Math.sqrt(h*h+_*_),m=0!=f?_/f:1,p=0!=f?h/f:0;return[[a,m*s,s*p,0,-s,a*m,a*p,0,0,-p,m,0,r*s-t*a,i*p-t*s*m-r*a*m,-t*s*p-r*a*p-i*m,1],[a,-s,0,0,m*s,m*a,-p,0,s*p,a*p,m,0,t,r,i,1]]}throw new Error("a1 and b1 is required!")}(i,o,n,e,u,a);return this.__matrix4=t(t(t(s[1],function(t){var r=Math.sin(t),i=Math.cos(t);return[i,r,0,0,-r,i,0,0,0,0,1,0,0,0,0,1]}(r)),s[0]),this.__matrix4),this},i.prototype.scale=function(r,i,o,n,e,u){return void 0===n&&(n=0),void 0===e&&(e=0),void 0===u&&(u=0),this.__matrix4=t(function(t,r,i,o,n,e){return void 0===o&&(o=0),void 0===n&&(n=0),void 0===e&&(e=0),[t,0,0,0,0,r,0,0,0,0,i,0,o-o*t,n-n*r,e-e*i,1]}(r,i,o,n,e,u),this.__matrix4),this},i.prototype.multiply=function(r,i){return void 0===i&&(i=!1),this.__matrix4=i?t(this.__matrix4,r):t(r,this.__matrix4),this},i.prototype.use=function(r,i,o,n){return void 0===o&&(o=0),void 0===n&&(n=1),t(this.__matrix4,[r,i,o,n])},i.prototype.value=function(){return this.__matrix4},i}();export{i as default};
|
package/lib/Mercator/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Mercator of VISLite JavaScript Library v1.2.0-alpha.
|
|
2
|
+
* Mercator of VISLite JavaScript Library v1.2.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
var t=function(t,a){void 0===t&&(t=7),void 0===a&&(a=[107,36]),this.name="Mercator";var r=100*t*Math.PI/180,e=r*a[0],i=-1*r*a[1];this.use=function(t,a){return[.8*(r*t-e),-1*r*a-i,0]}};export{t as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* RawCanvas of VISLite JavaScript Library v1.2.0-alpha.
|
|
2
|
+
* RawCanvas of VISLite JavaScript Library v1.2.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/VISLite.git
|
|
4
4
|
*/
|
|
5
5
|
var t=function(i,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])},t(i,e)};"function"==typeof SuppressedError&&SuppressedError;var i=function(t,i,e,n,r){var o=Math.cos(e),s=Math.sin(e);return[+((n-t)*o-(r-i)*s+t).toFixed(7),+((n-t)*s+(r-i)*o+i).toFixed(7)]};var e=function(t,i,e,n,r){return t.beginPath(),t.translate(e,n),t.rotate(r),t.font=i.fontStyle+" "+i.fontWeight+" "+i.fontSize+"px "+i.fontFamily,t},n=function(t,e,n,r,o,s,_,h){if(o>s){var a=o;o=s,s=a}return _%=2*Math.PI,h>=1.999999*Math.PI||h<=1.999999*-Math.PI?h=2*Math.PI:h%=2*Math.PI,function(t,e,n,r,o,s,_){e<0&&(t+=e,e*=-1);var h,a=[];h=i(0,0,t,o,0),a[0]=h[0],a[1]=h[1],h=i(0,0,e,h[0],h[1]),a[2]=h[0],a[3]=h[1],h=i(0,0,t,s,0),a[4]=h[0],a[5]=h[1],h=i(0,0,e,h[0],h[1]),a[6]=h[0],a[7]=h[1],_(t,t+e,a[0]+n,a[1]+r,a[4]+n,a[5]+r,a[2]+n,a[3]+r,a[6]+n,a[7]+r,.5*(s-o))}(_,h,n,r,o,s,(function(i,_,h,a,l,p,u,f,g,c,y){y<0&&(y=-y),t.beginPath(),t.moveTo(h,a),t.arc(n,r,o,i,_,!1),"round"==e.arcEndCap?t.arc(.5*(u+g),.5*(f+c),y,_-Math.PI,_,!0):"-round"==e.arcEndCap?t.arc(.5*(u+g),.5*(f+c),y,_-Math.PI,_,!1):t.lineTo(g,c),t.arc(n,r,s,_,i,!0),"round"==e.arcStartCap?t.arc(.5*(h+l),.5*(a+p),y,i,i-Math.PI,!0):"-round"==e.arcStartCap?t.arc(.5*(h+l),.5*(a+p),y,i,i-Math.PI,!1):t.lineTo(h,a)})),"butt"==e.arcStartCap&&t.closePath(),t},r=function(t,i,e,n){return t.beginPath(),t.moveTo(i+n,e),t.arc(i,e,n,0,2*Math.PI),t},o=function(t,i,e,n,r){return t.beginPath(),t.rect(i,e,n,r),t};function s(t,i,e,n,r){for(var o=0,s="",_=0;_<i.length;_++)t.measureText(s+i[_]).width>e||/\n$/.test(s)?(r(s,((o+=1)-.5)*n),s=i[_]):_==i.length-1?(o+=1,r(s+i[_],(o-.5)*n)):s+=i[_];return o*n}var _=function(){function t(t,i,e,n,r){void 0===i&&(i={}),void 0===n&&(n=!1),this.__region=null,this.__onlyRegion=!1,this.__onlyView=!1,this.__specialConfig={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt"},this.__initConfig={fillStyle:"black",strokeStyle:"black",lineWidth:1,textAlign:"left",textBaseline:"middle",lineDash:[],shadowBlur:0,shadowColor:"black"},this.painter=t.getContext("2d",i),this.__region=e,this.__isPainter=n,this.painter.textBaseline="middle",this.painter.textAlign="left"}return t.prototype.useConfig=function(t,i){if(this.__region&&!this.__onlyView&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,i),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(i);else if(t in this.__specialConfig)"fontSize"==t&&(i=Math.round(i)),this.__specialConfig[t]=i;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=i}return this},t.prototype.fillText=function(t,i,n,r){return void 0===r&&(r=0),this.__region&&!this.__onlyView&&this.__region.fillText(t,i,n,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),e(this.painter,this.__specialConfig,i,n,r).fillText(t,0,0),this.painter.restore()),this},t.prototype.strokeText=function(t,i,n,r){return void 0===r&&(r=0),this.__region&&!this.__onlyView&&this.__region.strokeText(t,i,n,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),e(this.painter,this.__specialConfig,i,n,r).strokeText(t,0,0),this.painter.restore()),this},t.prototype.fullText=function(t,i,n,r){return void 0===r&&(r=0),this.__region&&!this.__onlyView&&this.__region.fullText(t,i,n,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),e(this.painter,this.__specialConfig,i,n,r),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore()),this},t.prototype.fillTexts=function(t,i,n,r,o,_){var h=this;void 0===o&&(o=1.2),void 0===_&&(_=0);var a=0;if(this.__region&&!this.__onlyView&&(a=this.__region.fillTexts(t,i,n,r,o)),this.__isPainter&&this.__onlyRegion)return a;this.painter.save(),e(this.painter,this.__specialConfig,i,n,_);var l=s(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){h.painter.fillText(t,0,i)}));return this.painter.restore(),l},t.prototype.strokeTexts=function(t,i,n,r,o,_){var h=this;void 0===o&&(o=1.2),void 0===_&&(_=0);var a=0;if(this.__region&&!this.__onlyView&&(a=this.__region.fillTexts(t,i,n,r,o)),this.__isPainter&&this.__onlyRegion)return a;this.painter.save(),e(this.painter,this.__specialConfig,i,n,_);var l=s(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){h.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.fullTexts=function(t,i,n,r,o,_){var h=this;void 0===o&&(o=1.2),void 0===_&&(_=0);var a=0;if(this.__region&&!this.__onlyView&&(a=this.__region.fillTexts(t,i,n,r,o)),this.__isPainter&&this.__onlyRegion)return a;this.painter.save(),e(this.painter,this.__specialConfig,i,n,_);var l=s(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){h.painter.fillText(t,0,i),h.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.beginPath=function(){return this.__region&&!this.__onlyView&&this.__region.beginPath(),this.__isPainter&&this.__onlyRegion||this.painter.beginPath(),this},t.prototype.closePath=function(){return this.__region&&!this.__onlyView&&this.__region.closePath(),this.__isPainter&&this.__onlyRegion||this.painter.closePath(),this},t.prototype.moveTo=function(t,i){return this.__region&&!this.__onlyView&&this.__region.moveTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.moveTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.lineTo=function(t,i){return this.__region&&!this.__onlyView&&this.__region.lineTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.lineTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.arc=function(t,i,e,n,r){return this.__region&&!this.__onlyView&&this.__region.arc(t,i,e,n,r),this.__isPainter&&this.__onlyRegion||this.painter.arc(t,i,e,n,n+r,r<0),this},t.prototype.fill=function(){return this.__region&&!this.__onlyView&&this.__region.fill(),this.__isPainter&&this.__onlyRegion||this.painter.fill(),this},t.prototype.stroke=function(){return this.__region&&!this.__onlyView&&this.__region.stroke(),this.__isPainter&&this.__onlyRegion||this.painter.stroke(),this},t.prototype.full=function(){return this.__region&&!this.__onlyView&&this.__region.full(),this.__isPainter&&this.__onlyRegion||(this.painter.fill(),this.painter.stroke()),this},t.prototype.save=function(){return this.__region&&!this.__onlyView&&this.__region.save(),this.__isPainter&&this.__onlyRegion||this.painter.save(),this},t.prototype.restore=function(){return this.__region&&!this.__onlyView&&this.__region.restore(),this.__isPainter&&this.__onlyRegion||this.painter.restore(),this},t.prototype.clip=function(){return this.__region&&!this.__onlyView&&this.__region.clip(),this.__isPainter&&this.__onlyRegion||this.painter.clip(),this},t.prototype.quadraticCurveTo=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.quadraticCurveTo(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.quadraticCurveTo(t,i,e,n),this},t.prototype.bezierCurveTo=function(t,i,e,n,r,o){return this.__region&&!this.__onlyView&&this.__region.bezierCurveTo(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||this.painter.bezierCurveTo(t,i,e,n,r,o),this},t.prototype.clearRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.clearRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.clearRect(t,i,e,n),this},t.prototype.fillArc=function(t,i,e,r,o,s){return this.__region&&!this.__onlyView&&this.__region.fillArc(t,i,e,r,o,s),this.__isPainter&&this.__onlyRegion||n(this.painter,this.__specialConfig,t,i,e,r,o,s).fill(),this},t.prototype.strokeArc=function(t,i,e,r,o,s){return this.__region&&!this.__onlyView&&this.__region.strokeArc(t,i,e,r,o,s),this.__isPainter&&this.__onlyRegion||n(this.painter,this.__specialConfig,t,i,e,r,o,s).stroke(),this},t.prototype.fullArc=function(t,i,e,r,o,s){return this.__region&&!this.__onlyView&&this.__region.fullArc(t,i,e,r,o,s),this.__isPainter&&this.__onlyRegion||(n(this.painter,this.__specialConfig,t,i,e,r,o,s),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillCircle=function(t,i,e){return this.__region&&!this.__onlyView&&this.__region.fillCircle(t,i,e),this.__isPainter&&this.__onlyRegion||r(this.painter,t,i,e).fill(),this},t.prototype.strokeCircle=function(t,i,e){return this.__region&&!this.__onlyView&&this.__region.strokeCircle(t,i,e),this.__isPainter&&this.__onlyRegion||r(this.painter,t,i,e).stroke(),this},t.prototype.fullCircle=function(t,i,e){return this.__region&&!this.__onlyView&&this.__region.fullCircle(t,i,e),this.__isPainter&&this.__onlyRegion||(r(this.painter,t,i,e),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.fillRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||o(this.painter,t,i,e,n).fill(),this},t.prototype.strokeRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.strokeRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||o(this.painter,t,i,e,n).stroke(),this},t.prototype.fullRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.fullRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||(o(this.painter,t,i,e,n),this.painter.fill(),this.painter.stroke()),this},t.prototype.draw=function(){return Promise.resolve()},t.prototype.drawImage=function(t,i,e,n,r,o){var s=this;return void 0===o&&(o=!1),new Promise((function(_){if(s.__region&&!s.__onlyView&&s.__region.fillRect(i,e,n,r),s.__isPainter&&s.__onlyRegion)_({});else if("string"!=typeof t||o)s.painter.drawImage(t,0,0,n,r,i,e,n,r),_({});else{var h=new Image;h.onload=function(){s.painter.drawImage(h,0,0,h.width,h.height,i,e,n,r),_({})},h.src=t}}))},t.prototype.install=function(t){var i=this,e=function(e){if(e in n)throw new Error("VISLite Canvas:Method already exists and cannot be overwritten.");n[e]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=t[e].apply(i,n);return null!=o?o:i}},n=this;for(var r in t)e(r);return this},t}();var h=function(t){var i={value:function(){return t},setColor:function(e,n){return t.addColorStop(e,n),i}};return i},a=function(i){function n(t,e,n,r){void 0===n&&(n={}),void 0===r&&(r=1);var o=i.call(this,t,n,e?new _(e,{willReadFrequently:!0}):void 0,!0,r)||this;return o.name="Canvas",o.__regionList={},o.__regionAssemble=function(t,i,e,n){for(var r=[],o=0;o<n;o++)r[o]=t;return function(){for(var o=0;o<n;o++){if(r[o]+e<i){r[o]=+(r[o]+e).toFixed(7);break}o<n-1&&(r[o]=t)}return r}}(0,255,10,3),o.__scaleSize=r,o.setRegion(""),o}return function(i,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=i}t(i,e),i.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(n,i),n.prototype.config=function(t){for(var i in t)this.useConfig(i,t[i]);return this},n.prototype.onlyRegion=function(t){return this.__onlyRegion=t,this},n.prototype.onlyView=function(t){return this.__onlyView=t,this},n.prototype.setRegion=function(t){if(this.__region)if(t){if(null==this.__regionList[t]){var i=this.__regionAssemble();this.__regionList[t]="rgb("+i[0]+","+i[1]+","+i[2]+")"}this.__region.useConfig("fillStyle",this.__regionList[t])&&this.__region.useConfig("strokeStyle",this.__regionList[t])}else this.__region.useConfig("fillStyle","#000000")&&this.__region.useConfig("strokeStyle","#000000");return this},n.prototype.getRegion=function(t,i){var e=this;return new Promise((function(n){var r=e.__region?e.__region.painter.getImageData(t-.5,i-.5,1,1):{data:[0,0,0,0]},o=r.data,s=function(){if(e.__region)for(var t in e.__regionList)if("rgb("+o[0]+","+o[1]+","+o[2]+")"==e.__regionList[t]){n(t);break}n("")};o?s():r.then((function(t){o=t,s()}))}))},n.prototype.textWidth=function(t){this.painter.save(),e(this.painter,this.__specialConfig,0,0,0);var i=this.painter.measureText(t+"").width;return this.painter.restore(),i},n.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region?this.__region.painter:null:this.painter},n.prototype.getInfo=function(){return{width:this.painter.canvas.width/this.__scaleSize,height:this.painter.canvas.height/this.__scaleSize}},n.prototype.createLinearGradient=function(t,i,e,n){return function(t,i,e,n,r){var o=t.createLinearGradient(i,e,n,r);return h(o)}(this.painter,t,i,e,n)},n.prototype.createRadialGradient=function(t,i,e){return function(t,i,e,n){var r=t.createRadialGradient(i,e,0,i,e,n);return h(r)}(this.painter,t,i,e)},n.prototype.getColor=function(t,i){t*=this.__scaleSize,i*=this.__scaleSize;var e=this.painter.getImageData(t-.5,i-.5,1,1).data;return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},n}(_);export{a as default};
|
package/lib/SVG/index.es.js
CHANGED