vislite 0.6.0 → 0.7.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/CHANGELOG +9 -0
  2. package/README.md +4 -4
  3. package/lib/Buffer/index.umd.js +2 -2
  4. package/lib/Buffer/index.umd.min.js +2 -2
  5. package/lib/Canvas/index.umd.js +2 -2
  6. package/lib/Canvas/index.umd.min.js +2 -2
  7. package/lib/Cardinal/index.umd.js +2 -2
  8. package/lib/Cardinal/index.umd.min.js +2 -2
  9. package/lib/Eoap/index.umd.js +2 -2
  10. package/lib/Eoap/index.umd.min.js +2 -2
  11. package/lib/Geometry/index.umd.js +2 -2
  12. package/lib/Geometry/index.umd.min.js +2 -2
  13. package/lib/Hermite/index.umd.js +2 -2
  14. package/lib/Hermite/index.umd.min.js +2 -2
  15. package/lib/Matrix4/index.umd.js +2 -2
  16. package/lib/Matrix4/index.umd.min.js +2 -2
  17. package/lib/Mercator/index.umd.js +2 -2
  18. package/lib/Mercator/index.umd.min.js +2 -2
  19. package/lib/OralCanvas/index.es.js +2 -2
  20. package/lib/OralCanvas/index.es.min.js +2 -2
  21. package/lib/OralWebGL/index.es.js +2 -2
  22. package/lib/OralWebGL/index.es.min.js +2 -2
  23. package/lib/SVG/index.umd.js +2 -2
  24. package/lib/SVG/index.umd.min.js +2 -2
  25. package/lib/Shader/index.umd.js +2 -2
  26. package/lib/Shader/index.umd.min.js +2 -2
  27. package/lib/Texture/index.umd.js +2 -2
  28. package/lib/Texture/index.umd.min.js +2 -2
  29. package/lib/TreeLayout/index.umd.js +2 -2
  30. package/lib/TreeLayout/index.umd.min.js +2 -2
  31. package/lib/WebGL/index.umd.js +2 -2
  32. package/lib/WebGL/index.umd.min.js +2 -2
  33. package/lib/animation/index.umd.js +2 -2
  34. package/lib/animation/index.umd.min.js +2 -2
  35. package/lib/formatColor/index.umd.js +2 -2
  36. package/lib/formatColor/index.umd.min.js +2 -2
  37. package/lib/getLoopColors/index.umd.js +2 -2
  38. package/lib/getLoopColors/index.umd.min.js +2 -2
  39. package/lib/getWebGLContext/index.umd.js +2 -2
  40. package/lib/getWebGLContext/index.umd.min.js +2 -2
  41. package/lib/index.umd.js +2 -2
  42. package/lib/index.umd.min.js +2 -2
  43. package/lib/move/index.umd.js +2 -2
  44. package/lib/move/index.umd.min.js +2 -2
  45. package/lib/resizeObserver/index.umd.js +2 -2
  46. package/lib/resizeObserver/index.umd.min.js +2 -2
  47. package/lib/rotate/index.umd.js +2 -2
  48. package/lib/rotate/index.umd.min.js +2 -2
  49. package/lib/ruler/index.umd.js +2 -2
  50. package/lib/ruler/index.umd.min.js +2 -2
  51. package/lib/scale/index.umd.js +2 -2
  52. package/lib/scale/index.umd.min.js +2 -2
  53. package/lib/throttle/index.umd.js +2 -2
  54. package/lib/throttle/index.umd.min.js +2 -2
  55. package/lib/viewHandler/index.umd.js +2 -2
  56. package/lib/viewHandler/index.umd.min.js +2 -2
  57. package/package/TreeLayout/index.ts +2 -2
  58. package/package.json +1 -1
  59. package/src/Canvas.ts +70 -70
  60. package/src/Eoap.ts +66 -66
  61. package/src/Geometry.ts +82 -82
  62. package/src/Matrix4/index.ts +84 -84
  63. package/src/Matrix4/move.ts +12 -12
  64. package/src/Matrix4/rotate.ts +15 -15
  65. package/src/Matrix4/transform.ts +64 -64
  66. package/src/Mercator.ts +27 -27
  67. package/src/SVG.ts +24 -24
  68. package/src/WebGL.ts +66 -66
  69. package/src/animation.ts +98 -98
  70. package/src/common/assemble.ts +22 -22
  71. package/src/common/canvas/arc.ts +51 -51
  72. package/src/common/canvas/config.ts +158 -158
  73. package/src/common/canvas/gradient.ts +29 -29
  74. package/src/common/canvas/index.ts +177 -177
  75. package/src/common/canvas/painter.ts +417 -417
  76. package/src/common/geometry/prism-horizontal.ts +35 -35
  77. package/src/common/geometry/prism-vertical.ts +40 -40
  78. package/src/common/geometry/sphere-fragment.ts +40 -40
  79. package/src/common/geometry/tool/circle.ts +11 -11
  80. package/src/common/mergeOption.ts +6 -6
  81. package/src/common/setStyle.ts +5 -5
  82. package/src/common/svg/config.ts +186 -186
  83. package/src/common/svg/gradient.ts +63 -63
  84. package/src/common/svg/index.ts +5 -5
  85. package/src/common/svg/tool.ts +44 -44
  86. package/src/common/tree/toInnerTree.ts +57 -57
  87. package/src/common/tree/toPlainTree.ts +132 -132
  88. package/src/common/webgl/buffer.ts +79 -79
  89. package/src/common/webgl/doDraw.ts +108 -108
  90. package/src/common/webgl/getColorFactory.ts +26 -26
  91. package/src/common/webgl/getShader.ts +48 -48
  92. package/src/common/webgl/getTexture.ts +11 -11
  93. package/src/common/webgl/getWebGLContext.ts +28 -28
  94. package/src/common/webgl/index.ts +224 -224
  95. package/src/common/webgl/shader.ts +75 -75
  96. package/src/common/webgl/texture.ts +97 -97
  97. package/src/formatColor.ts +44 -44
  98. package/src/getLoopColors.ts +42 -42
  99. package/src/interpolation/Cardinal.ts +110 -110
  100. package/src/interpolation/Hermite.ts +65 -65
  101. package/src/layout/TreeLayout.ts +186 -186
  102. package/src/move.ts +7 -7
  103. package/src/resizeObserver.ts +37 -37
  104. package/src/rotate.ts +7 -7
  105. package/src/ruler.ts +209 -209
  106. package/src/throttle.ts +52 -52
  107. package/src/viewHandler.ts +158 -158
  108. package/types/Canvas.d.ts +308 -308
  109. package/types/CanvasOption.d.ts +8 -8
  110. package/types/CanvasOpts.d.ts +9 -9
  111. package/types/Matrix4.d.ts +47 -47
  112. package/types/SVGConfig.d.ts +79 -76
  113. package/uni-app/ui-canvas.vue +9 -31
  114. package/.editorconfig +0 -19
  115. package/.eslintrc.js +0 -26
@@ -1,48 +1,48 @@
1
- export default interface Matrix4Type {
2
-
3
- /**
4
- * 返回matrix4当前记录的内部矩阵
5
- */
6
- value(): number[]
7
-
8
- /**
9
- * 两个矩阵相乘
10
- * @param newMatrix4
11
- * @param flag 可选,表示相乘位置,默认false,表示左乘
12
- */
13
- multiply(newMatrix4: number[], flag?: boolean): this
14
-
15
- /**
16
- * 把变换矩阵作用在具体的点上
17
- */
18
- use(x: number, y: number, z?: number, w?: number): [number, number, number, number]
19
-
20
- /**
21
- * 设置内置矩阵
22
- */
23
- setValue(initMatrix4?: number[]): this
24
-
25
- /**
26
- * 沿着向量(a, b, c)方向移动距离dis
27
- * (其中c可以不传,默认0)
28
- */
29
- move(dis: number, a: number, b: number, c?: number): this
30
-
31
- /**
32
- * 以点(cx, cy, cz)为中心,分别在x、y和z方向上缩放xTimes、yTimes和zTimes倍
33
- * (其中cx、cy和cz都可以不传递,默认0)
34
- */
35
- scale(xTimes: number, yTimes: number, zTimes: number, cx?: number, cy?: number, cz?: number): this
36
-
37
- /**
38
- * 围绕射线(a1, b1, c1) -> (a2, b2, c2)旋转deg度
39
- * (方向由右手法则确定)
40
- *
41
- * a1、b1、c1、a2、b2和c2这6个值在设置的时候,不是一定需要全部设置,还有以下可选:
42
- *
43
- * 1)只设置了a1和b1,表示在xoy平面围绕(a1, b1)旋转
44
- * 2)设置三个点(设置不足六个点都认为只设置了三个点),表示围绕从原点出发的射线旋转
45
- */
46
- rotate(deg: number, a1: number, b1: number, c1?: number, a2?: number, b2?: number, c2?: number): this
47
-
1
+ export default interface Matrix4Type {
2
+
3
+ /**
4
+ * 返回matrix4当前记录的内部矩阵
5
+ */
6
+ value(): number[]
7
+
8
+ /**
9
+ * 两个矩阵相乘
10
+ * @param newMatrix4
11
+ * @param flag 可选,表示相乘位置,默认false,表示左乘
12
+ */
13
+ multiply(newMatrix4: number[], flag?: boolean): this
14
+
15
+ /**
16
+ * 把变换矩阵作用在具体的点上
17
+ */
18
+ use(x: number, y: number, z?: number, w?: number): [number, number, number, number]
19
+
20
+ /**
21
+ * 设置内置矩阵
22
+ */
23
+ setValue(initMatrix4?: number[]): this
24
+
25
+ /**
26
+ * 沿着向量(a, b, c)方向移动距离dis
27
+ * (其中c可以不传,默认0)
28
+ */
29
+ move(dis: number, a: number, b: number, c?: number): this
30
+
31
+ /**
32
+ * 以点(cx, cy, cz)为中心,分别在x、y和z方向上缩放xTimes、yTimes和zTimes倍
33
+ * (其中cx、cy和cz都可以不传递,默认0)
34
+ */
35
+ scale(xTimes: number, yTimes: number, zTimes: number, cx?: number, cy?: number, cz?: number): this
36
+
37
+ /**
38
+ * 围绕射线(a1, b1, c1) -> (a2, b2, c2)旋转deg度
39
+ * (方向由右手法则确定)
40
+ *
41
+ * a1、b1、c1、a2、b2和c2这6个值在设置的时候,不是一定需要全部设置,还有以下可选:
42
+ *
43
+ * 1)只设置了a1和b1,表示在xoy平面围绕(a1, b1)旋转
44
+ * 2)设置三个点(设置不足六个点都认为只设置了三个点),表示围绕从原点出发的射线旋转
45
+ */
46
+ rotate(deg: number, a1: number, b1: number, c1?: number, a2?: number, b2?: number, c2?: number): this
47
+
48
48
  }
@@ -1,77 +1,80 @@
1
- import { arcCapType, textAlignType, textBaselineType } from './painterConfig'
2
-
3
- export default interface SVGConfigType {
4
-
5
- /**
6
- * 填充色或图案,默认"#000"
7
- */
8
- fillStyle?: string
9
-
10
- /**
11
- * 轮廓色或图案,默认"#000"
12
- */
13
- strokeStyle?: string
14
-
15
- /**
16
- * 线条宽度,默认1(单位px)
17
- */
18
- lineWidth?: number
19
-
20
- /**
21
- * 文字水平对齐方式,默认"left"左对齐(还有"center"居中和"right"右对齐)
22
- */
23
- textAlign?: textAlignType
24
-
25
- /**
26
- * 文字垂直对齐方式,默认"middle"垂直居中(还有"top"上对齐和"bottom"下对齐)
27
- */
28
- textBaseline?: textBaselineType
29
-
30
- /**
31
- * 设置线条虚线,默认为[]表示使用实线绘制
32
- *
33
- * 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
34
- */
35
- lineDash?: Array<number>
36
-
37
- /**
38
- * 文字大小,默认16
39
- */
40
- "fontSize"?: number
41
-
42
- /**
43
- * 已废弃,向下兼容,请用 fontSize 代替
44
- */
45
- "font-size"?: number // 向下兼容
46
-
47
- /**
48
- * 字体,默认"sans-serif"
49
- */
50
- "fontFamily"?: string
51
-
52
- /**
53
- * 已废弃,向下兼容,请用 fontFamily 代替
54
- */
55
- "font-family"?: string // 向下兼容
56
-
57
- /**
58
- * 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
59
- */
60
- "arcStartCap"?: arcCapType
61
-
62
- /**
63
- * 已废弃,向下兼容,请用 arcStartCap 代替
64
- */
65
- "arc-start-cap"?: string // 向下兼容
66
-
67
- /**
68
- * 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
69
- */
70
- "arcEndCap"?: arcCapType
71
-
72
- /**
73
- * 已废弃,向下兼容,请用 arcEndCap 代替
74
- */
75
- "arc-end-cap"?: string // 向下兼容
76
-
1
+ import { arcCapType, textAlignType, textBaselineType } from './painterConfig'
2
+
3
+ export type svgElType = SVGElement | "g" | "text" | "path" | "circle" | "rect" | "polygon" | "polyline"
4
+ export type svgBoardType = SVGElement | "text" | "path" | "arc" | "circle" | "rect"
5
+
6
+ export default interface SVGConfigType {
7
+
8
+ /**
9
+ * 填充色或图案,默认"#000"
10
+ */
11
+ fillStyle?: string
12
+
13
+ /**
14
+ * 轮廓色或图案,默认"#000"
15
+ */
16
+ strokeStyle?: string
17
+
18
+ /**
19
+ * 线条宽度,默认1(单位px)
20
+ */
21
+ lineWidth?: number
22
+
23
+ /**
24
+ * 文字水平对齐方式,默认"left"左对齐(还有"center"居中和"right"右对齐)
25
+ */
26
+ textAlign?: textAlignType
27
+
28
+ /**
29
+ * 文字垂直对齐方式,默认"middle"垂直居中(还有"top"上对齐和"bottom"下对齐)
30
+ */
31
+ textBaseline?: textBaselineType
32
+
33
+ /**
34
+ * 设置线条虚线,默认为[]表示使用实线绘制
35
+ *
36
+ * 值应该是一个数组,格式:[实线长,虚线长,实线长 ...],数组长度任意,会自动循环
37
+ */
38
+ lineDash?: Array<number>
39
+
40
+ /**
41
+ * 文字大小,默认16
42
+ */
43
+ "fontSize"?: number
44
+
45
+ /**
46
+ * 已废弃,向下兼容,请用 fontSize 代替
47
+ */
48
+ "font-size"?: number // 向下兼容
49
+
50
+ /**
51
+ * 字体,默认"sans-serif"
52
+ */
53
+ "fontFamily"?: string
54
+
55
+ /**
56
+ * 已废弃,向下兼容,请用 fontFamily 代替
57
+ */
58
+ "font-family"?: string // 向下兼容
59
+
60
+ /**
61
+ * 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
62
+ */
63
+ "arcStartCap"?: arcCapType
64
+
65
+ /**
66
+ * 已废弃,向下兼容,请用 arcStartCap 代替
67
+ */
68
+ "arc-start-cap"?: string // 向下兼容
69
+
70
+ /**
71
+ * 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
72
+ */
73
+ "arcEndCap"?: arcCapType
74
+
75
+ /**
76
+ * 已废弃,向下兼容,请用 arcEndCap 代替
77
+ */
78
+ "arc-end-cap"?: string // 向下兼容
79
+
77
80
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <view :class="cover || isH5 ? 'cover-view' : 'normal-view'">
3
- <view :class="'view-img view-' + uniqueid" @touchstart="doitstart">
2
+ <view :class="cover || isH5 ? 'cover-view' : 'normal-view'" :style="{ display: 'inline-block' }">
3
+ <view v-if="!cover && !isH5" :class="'view-img view-' + uniqueid" @touchstart="doitstart">
4
4
  <image
5
5
  :style="{ width: width + 'px', height: height + 'px' }"
6
6
  :src="viewImg"
@@ -12,13 +12,13 @@
12
12
  class="painter"
13
13
  :id="'painter-' + uniqueid"
14
14
  @touchstart="doitstart"
15
- :style="{ width: width + 'px', height: height + 'px' }"
15
+ :style="[{ width: width + 'px', height: height + 'px'}, cover || isH5 ? {} : {position: 'fixed', left: '50000px'}]"
16
16
  ></canvas>
17
17
  <canvas
18
18
  v-if="region"
19
19
  class="region"
20
20
  :id="'region-' + uniqueid"
21
- :style="{ width: width + 'px', height: height + 'px' }"
21
+ :style="{ width: width + 'px', height: height + 'px', position: 'fixed', left: '50000px' }"
22
22
  ></canvas>
23
23
  <!-- #endif -->
24
24
  <!-- #ifdef MP-WEIXIN -->
@@ -26,13 +26,13 @@
26
26
  class="painter"
27
27
  canvas-id="painter"
28
28
  @touchstart="doitstart"
29
- :style="{ width: width + 'px', height: height + 'px' }"
29
+ :style="[{ width: width + 'px', height: height + 'px'}, cover || isH5 ? {} : {position: 'fixed', left: '50000px'}]"
30
30
  ></canvas>
31
31
  <canvas
32
32
  v-if="region"
33
33
  class="region"
34
34
  canvas-id="region"
35
- :style="{ width: width + 'px', height: height + 'px' }"
35
+ :style="{ width: width + 'px', height: height + 'px', position: 'fixed', left: '50000px' }"
36
36
  ></canvas>
37
37
  <!-- #endif -->
38
38
  <!-- #ifndef MP-WEIXIN||MP-ALIPAY -->
@@ -40,18 +40,18 @@
40
40
  class="painter"
41
41
  :canvas-id="'painter-' + uniqueid"
42
42
  @touchstart="doitstart"
43
- :style="{ width: width + 'px', height: height + 'px' }"
43
+ :style="[{ width: width + 'px', height: height + 'px'}, cover || isH5 ? {} : {position: 'fixed', left: '50000px'}]"
44
44
  ></canvas>
45
45
  <canvas
46
46
  v-if="region"
47
47
  class="region"
48
48
  :canvas-id="'region-' + uniqueid"
49
- :style="{ width: width + 'px', height: height + 'px' }"
49
+ :style="{ width: width + 'px', height: height + 'px', position: 'fixed', left: '50000px' }"
50
50
  ></canvas>
51
51
  <!-- #endif -->
52
52
  </view>
53
53
  </template>
54
- <script>
54
+ <script>
55
55
  import OralCanvas from "../lib/OralCanvas/index.es.js";
56
56
  export default {
57
57
  data() {
@@ -235,25 +235,3 @@ export default {
235
235
  },
236
236
  };
237
237
  </script>
238
-
239
- <style lang="css" scoped>
240
- /* 辅助的区域不应该可以看见 */
241
- .region {
242
- position: fixed;
243
- left: 50000px;
244
- }
245
-
246
- .cover-view,
247
- .normal-view {
248
- display: inline-block;
249
- }
250
-
251
- .cover-view .view-img {
252
- display: none;
253
- }
254
-
255
- .normal-view .painter {
256
- position: fixed;
257
- left: 50000px;
258
- }
259
- </style>
package/.editorconfig DELETED
@@ -1,19 +0,0 @@
1
- # http://editorconfig.org
2
-
3
- root = true
4
-
5
- [*]
6
- charset = utf-8
7
- indent_style = space
8
- indent_size = 4
9
- end_of_line = cr
10
- insert_final_newline = false
11
- trim_trailing_whitespace = true
12
-
13
- [*.md]
14
- insert_final_newline = false
15
- trim_trailing_whitespace = false
16
-
17
- [*.json]
18
- indent_size = 2
19
- insert_final_newline = true
package/.eslintrc.js DELETED
@@ -1,26 +0,0 @@
1
- module.exports = {
2
-
3
- //定义ESLint的解析器
4
- parser: '@typescript-eslint/parser',
5
-
6
- //定义文件继承的子规范
7
- extends: ['plugin:@typescript-eslint/recommended'],
8
-
9
- //定义了该eslint文件所依赖的插件
10
- plugins: ['@typescript-eslint'],
11
-
12
- //指定代码的运行环境
13
- env: {
14
- browser: true,
15
- node: false
16
- },
17
-
18
- // 设置规则
19
- rules: {
20
- "@typescript-eslint/ban-types": "off",
21
- "@typescript-eslint/no-explicit-any": "off",
22
- "@typescript-eslint/no-this-alias": ["error", {
23
- "allowedNames": ["_this"]
24
- }]
25
- }
26
- }