vislite 1.3.0-alpha.0 → 1.3.0-beta.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 (73) hide show
  1. package/CHANGELOG +11 -1
  2. package/README.md +113 -26
  3. package/lib/Buffer/index.es.js +1 -1
  4. package/lib/Buffer/index.es.min.js +1 -1
  5. package/lib/Canvas/index.es.js +15 -2
  6. package/lib/Canvas/index.es.min.js +2 -2
  7. package/lib/Cardinal/index.es.js +1 -1
  8. package/lib/Cardinal/index.es.min.js +1 -1
  9. package/lib/Eoap/index.es.js +1 -1
  10. package/lib/Eoap/index.es.min.js +1 -1
  11. package/lib/Hermite/index.es.js +1 -1
  12. package/lib/Hermite/index.es.min.js +1 -1
  13. package/lib/MapCoordinate/index.es.d.ts +3 -0
  14. package/lib/MapCoordinate/index.es.js +217 -0
  15. package/lib/MapCoordinate/index.es.min.d.ts +3 -0
  16. package/lib/MapCoordinate/index.es.min.js +5 -0
  17. package/lib/Matrix4/index.es.js +1 -1
  18. package/lib/Matrix4/index.es.min.js +1 -1
  19. package/lib/Mercator/index.es.js +1 -1
  20. package/lib/Mercator/index.es.min.js +1 -1
  21. package/lib/RawCanvas/index.es.js +15 -2
  22. package/lib/RawCanvas/index.es.min.js +2 -2
  23. package/lib/SVG/index.es.js +47 -20
  24. package/lib/SVG/index.es.min.js +2 -2
  25. package/lib/Shader/index.es.js +1 -1
  26. package/lib/Shader/index.es.min.js +1 -1
  27. package/lib/Texture/index.es.js +1 -1
  28. package/lib/Texture/index.es.min.js +1 -1
  29. package/lib/TreeLayout/index.es.js +1 -1
  30. package/lib/TreeLayout/index.es.min.js +1 -1
  31. package/lib/animation/index.es.js +1 -1
  32. package/lib/animation/index.es.min.js +1 -1
  33. package/lib/assemble/index.es.js +1 -1
  34. package/lib/assemble/index.es.min.js +1 -1
  35. package/lib/getLoopColors/index.es.js +1 -1
  36. package/lib/getLoopColors/index.es.min.js +1 -1
  37. package/lib/getWebGLContext/index.es.js +1 -1
  38. package/lib/getWebGLContext/index.es.min.js +1 -1
  39. package/lib/index.umd.js +177 -21
  40. package/lib/index.umd.min.js +2 -2
  41. package/lib/initOption/index.es.js +1 -1
  42. package/lib/initOption/index.es.min.js +1 -1
  43. package/lib/mergeOption/index.es.js +1 -1
  44. package/lib/mergeOption/index.es.min.js +1 -1
  45. package/lib/move/index.es.js +1 -1
  46. package/lib/move/index.es.min.js +1 -1
  47. package/lib/rotate/index.es.js +1 -1
  48. package/lib/rotate/index.es.min.js +1 -1
  49. package/lib/ruler/index.es.js +1 -1
  50. package/lib/ruler/index.es.min.js +1 -1
  51. package/lib/scale/index.es.js +1 -1
  52. package/lib/scale/index.es.min.js +1 -1
  53. package/lib/throttle/index.es.js +1 -1
  54. package/lib/throttle/index.es.min.js +1 -1
  55. package/package/MapCoordinate/index.ts +3 -0
  56. package/package/index.ts +5 -0
  57. package/package.json +1 -3
  58. package/src/common/canvas/default.ts +1 -1
  59. package/src/common/canvas/painter.ts +13 -0
  60. package/src/common/map/getBoundary.ts +16 -0
  61. package/src/common/map/tool.ts +30 -0
  62. package/src/common/svg/config.ts +29 -10
  63. package/src/common/svg/default.ts +4 -1
  64. package/src/common/svg/gradient.ts +1 -1
  65. package/src/common/svg/index.ts +6 -6
  66. package/src/common/svg/tool.ts +9 -0
  67. package/src/coordinate/MapCoordinate.ts +81 -0
  68. package/types/Canvas.d.ts +8 -0
  69. package/types/CanvasConfig.d.ts +0 -30
  70. package/types/MapConfig.d.ts +28 -0
  71. package/types/MapCoordinate.d.ts +23 -0
  72. package/types/SVGConfig.d.ts +2 -20
  73. package/types/index.d.ts +15 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * throttle of VISLite JavaScript Library v1.3.0-alpha.0
2
+ * throttle of VISLite JavaScript Library v1.3.0-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  */
5
5
  function t(t,e){var n={time:200,keep:!1,opportunity:"end"};if(e)for(var p in e)n[p]=e[p];var r,i=!1,o=!1,a=!1;return function(){const e=this;if(r=arguments,i)o=!0,a=!0;else{"end"!=n.opportunity&&t.apply(e,r),i=!0;var p=setInterval((()=>{o?n.keep||t.apply(e,r):("begin"!=n.opportunity&&(a||"end"==n.opportunity)&&t.apply(e,r),i=!1,a=!1,clearInterval(p)),o=!1}),n.time)}}}export{t as default};
@@ -0,0 +1,3 @@
1
+ import MapCoordinate from "../../src/coordinate/MapCoordinate"
2
+
3
+ export default MapCoordinate
package/package/index.ts CHANGED
@@ -24,6 +24,8 @@ import Mercator from "./Mercator/index"
24
24
 
25
25
  import throttle from "./throttle/index"
26
26
 
27
+ import MapCoordinate from "./MapCoordinate/index"
28
+
27
29
  import TreeLayout from "./TreeLayout/index"
28
30
 
29
31
  import initOption from "./initOption/index"
@@ -67,6 +69,9 @@ export default {
67
69
  throttle,
68
70
  assemble,
69
71
 
72
+ // 坐标系
73
+ MapCoordinate,
74
+
70
75
  // 布局
71
76
  TreeLayout,
72
77
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vislite",
3
- "version": "1.3.0-alpha.0",
3
+ "version": "1.3.0-beta.0",
4
4
  "description": "灵活、快速、简单的数据可视化交互式跨端前端库",
5
5
  "main": "./lib/index.umd.min.js",
6
6
  "typings": "./types/index.d.ts",
@@ -8,7 +8,6 @@
8
8
  "jsdelivr": "./lib/index.umd.min.js",
9
9
  "sideEffects": false,
10
10
  "scripts": {
11
- "init": "npm install && oipage-cli --copy ./node_modules/pageby/dist/pageby.min.js ./docs/js/min/pageby.min.js",
12
11
  "dev": "webpack serve --config ./build/webpack.config.js",
13
12
  "build": "oipage-cli --delete ./lib && node ./build/pkg.js",
14
13
  "test": "karma start ./build/karma.config.js",
@@ -61,7 +60,6 @@
61
60
  "karma-chrome-launcher": "^3.1.0",
62
61
  "karma-jasmine": "^4.0.1",
63
62
  "karma-webpack": "^5.0.0",
64
- "pageby": "^0.1.0",
65
63
  "rollup": "^3.20.6",
66
64
  "terser": "^5.17.1",
67
65
  "ts-loader": "^9.2.8",
@@ -22,7 +22,7 @@ export default function (type?: string) {
22
22
  "arcEndCap": <arcCapType>'butt',
23
23
 
24
24
  // 矩形圆角半径
25
- "rectRadius": 0
25
+ "rectRadius": []
26
26
  }
27
27
 
28
28
  const init = {
@@ -287,6 +287,19 @@ class Painter {
287
287
  this.painter.clearRect(x, y, w, h)
288
288
  return this
289
289
  }
290
+ clearCircle(cx: number, cy: number, r: number) {
291
+ if (this.__region && !this.__onlyView) this.__region.clearCircle(cx, cy, r)
292
+
293
+ if (this.__isPainter && this.__onlyRegion) return this
294
+
295
+ this.painter.beginPath()
296
+ this.painter.globalCompositeOperation = "destination-out"
297
+ this.painter.arc(cx, cy, r, 0, Math.PI * 2)
298
+ this.painter.fill()
299
+ this.painter.globalCompositeOperation = "source-over"
300
+ this.painter.closePath()
301
+ return this
302
+ }
290
303
 
291
304
  // 弧
292
305
  fillArc(cx: number, cy: number, r1: number, r2: number, beginDeg: number, deg: number) {
@@ -0,0 +1,16 @@
1
+ import { mllData } from "./tool"
2
+
3
+ export default function (...geos: any[]) {
4
+ let minLongitude: any = null, maxLongitude: any = null, minLatitude: any = null, maxLatitude: any = null
5
+
6
+ for (let geoJson of geos) {
7
+ let [_minLongitude, _maxLongitude, _minLatitude, _maxLatitude] = mllData(geoJson)
8
+
9
+ if (minLongitude == void 0 || _minLongitude < minLongitude) minLongitude = _minLongitude
10
+ if (maxLongitude == void 0 || _maxLongitude > maxLongitude) maxLongitude = _maxLongitude
11
+ if (minLatitude == void 0 || _minLatitude < minLatitude) minLatitude = _minLatitude
12
+ if (maxLatitude == void 0 || _maxLatitude > maxLatitude) maxLatitude = _maxLatitude
13
+ }
14
+
15
+ return [minLongitude, maxLongitude, minLatitude, maxLatitude]
16
+ }
@@ -0,0 +1,30 @@
1
+ export function mllData(geoJson: any) {
2
+ let minLongitude: any = null, maxLongitude: any = null, minLatitude: any = null, maxLatitude: any = null
3
+
4
+ let forPolygon = function (coordinates: any) {
5
+ for (let j = 0; j < coordinates.length; j++) {
6
+ for (let k = 0; k < coordinates[j].length; k++) {
7
+ let longitude = coordinates[j][k][0], latitude = coordinates[j][k][1]
8
+
9
+ if (minLongitude == void 0 || minLongitude > longitude) minLongitude = longitude
10
+ if (maxLongitude == void 0 || maxLongitude < longitude) maxLongitude = longitude
11
+
12
+ if (minLatitude == void 0 || minLatitude > latitude) minLatitude = latitude
13
+ if (maxLatitude == void 0 || maxLatitude < latitude) maxLatitude = latitude
14
+ }
15
+ }
16
+ };
17
+
18
+ let features = geoJson.features
19
+ for (let i = 0; i < features.length; i++) {
20
+ if (features[i].geometry.type == "Polygon") {
21
+ forPolygon(features[i].geometry.coordinates)
22
+ } else if (features[i].geometry.type == "MultiPolygon") {
23
+ for (let j = 0; j < features[i].geometry.coordinates.length; j++) {
24
+ forPolygon(features[i].geometry.coordinates[j])
25
+ }
26
+ }
27
+ }
28
+
29
+ return [minLongitude, maxLongitude, minLatitude, maxLatitude]
30
+ }
@@ -76,24 +76,28 @@ export const initCircle = (el: SVGElement, cx: number, cy: number, r: number) =>
76
76
  }
77
77
 
78
78
  // 路径统一设置方法
79
- export const initPath = (el: SVGElement, path: string, config: SVGConfigType) => {
79
+ export const initPath = (el: SVGElement, path: string) => {
80
80
  if (el.nodeName.toLowerCase() !== "path") throw new Error("Need a <path> !")
81
81
  setAttribute(el, "d", path)
82
- setAttribute(el, "stroke-dasharray", (config.lineDash as Array<number>).join(','))
83
- setAttribute(el, "stroke-width", config.lineWidth + "")
84
- setAttribute(el, "stroke-linecap", config.lineCap + "")
85
- setAttribute(el, "stroke-linejoin", config.lineJoin + "")
86
82
  }
87
83
 
88
84
  // 画矩形统一设置方法
89
85
  export const initRect = (
90
86
  el: SVGElement,
87
+ config: SVGConfigType,
91
88
  x: number,
92
89
  y: number,
93
90
  width: number,
94
91
  height: number
95
92
  ) => {
96
- if (el.nodeName.toLowerCase() !== "rect") throw new Error("Need a <rect> !")
93
+ if (el.nodeName.toLowerCase() !== "path") throw new Error("Need a <path> !")
94
+
95
+ const rectRadius: Array<number> = [];
96
+ if (Array.isArray(config.rectRadius) && config.rectRadius.length > 0) {
97
+ for (let index = 0; index < 4; index++) {
98
+ rectRadius.push(...config.rectRadius)
99
+ }
100
+ }
97
101
 
98
102
  // 由于高和宽不可以是负数,校对一下
99
103
  if (height < 0) {
@@ -105,10 +109,25 @@ export const initRect = (
105
109
  x -= width
106
110
  }
107
111
 
108
- setAttribute(el, "x", x)
109
- setAttribute(el, "y", y)
110
- setAttribute(el, "width", width)
111
- setAttribute(el, "height", height)
112
+ let d = ""
113
+ if (rectRadius.length >= 4) {
114
+ d = "M" + (x + rectRadius[0]) + " " + y
115
+ d += "L" + (x + width - rectRadius[1]) + " " + y
116
+ d += "A" + rectRadius[1] + " " + rectRadius[1] + " 0 0 1 " + (x + width) + " " + (y + rectRadius[1])
117
+ d += "L" + (x + width) + " " + (y + height - rectRadius[2])
118
+ d += "A" + rectRadius[2] + " " + rectRadius[2] + " 0 0 1 " + (x + width - rectRadius[2]) + " " + (y + height)
119
+ d += "L" + (x + rectRadius[3]) + " " + (y + height)
120
+ d += "A" + rectRadius[3] + " " + rectRadius[3] + " 0 0 1 " + x + " " + (y + height - rectRadius[3])
121
+ d += "L" + x + " " + (y + rectRadius[0])
122
+ d += "A" + rectRadius[0] + " " + rectRadius[0] + " 0 0 1 " + (x + rectRadius[0]) + " " + y
123
+ } else {
124
+ d = "M" + x + " " + y
125
+ d += "L" + (x + width) + " " + y
126
+ d += "L" + (x + width) + " " + (y + height)
127
+ d += "L" + x + " " + (y + height)
128
+ d += "Z"
129
+ }
130
+ setAttribute(el, "d", d)
112
131
  }
113
132
 
114
133
  // 画弧统一设置方法
@@ -22,6 +22,9 @@ export default function () {
22
22
  lineDash: [],
23
23
  lineWidth: 1,
24
24
  lineCap: <lineCapType>"butt",
25
- lineJoin: <lineJoinType>"miter"
25
+ lineJoin: <lineJoinType>"miter",
26
+
27
+ // 矩形圆角半径
28
+ "rectRadius": []
26
29
  }
27
30
  }
@@ -4,7 +4,7 @@ import { toNode, setAttribute } from "./tool"
4
4
  const enhanceGradient = function (gradient: SVGElement, gradientId: string) {
5
5
  const enhanceGradient = {
6
6
  "value": function () {
7
- return "url(#" + gradientId + ")";
7
+ return "url(#" + gradientId + ")"
8
8
  },
9
9
  "setColor": function (stop: number, color: string) {
10
10
 
@@ -202,17 +202,17 @@ class SVG {
202
202
 
203
203
  // 矩形
204
204
  fillRect(x: number, y: number, width: number, height: number) {
205
- initRect(this.__useEl, x, y, width, height)
205
+ initRect(this.__useEl, this.__config, x, y, width, height)
206
206
  fill(this.__useEl, this.__config)
207
207
  return this
208
208
  }
209
209
  strokeRect(x: number, y: number, width: number, height: number) {
210
- initRect(this.__useEl, x, y, width, height)
210
+ initRect(this.__useEl, this.__config, x, y, width, height)
211
211
  stroke(this.__useEl, this.__config)
212
212
  return this
213
213
  }
214
214
  fullRect(x: number, y: number, width: number, height: number) {
215
- initRect(this.__useEl, x, y, width, height)
215
+ initRect(this.__useEl, this.__config, x, y, width, height)
216
216
  full(this.__useEl, this.__config)
217
217
  return this
218
218
  }
@@ -240,17 +240,17 @@ class SVG {
240
240
  return this
241
241
  }
242
242
  fill() {
243
- initPath(this.__useEl, this.__path, this.__config)
243
+ initPath(this.__useEl, this.__path)
244
244
  fill(this.__useEl, this.__config)
245
245
  return this
246
246
  }
247
247
  stroke() {
248
- initPath(this.__useEl, this.__path, this.__config)
248
+ initPath(this.__useEl, this.__path)
249
249
  stroke(this.__useEl, this.__config)
250
250
  return this
251
251
  }
252
252
  full() {
253
- initPath(this.__useEl, this.__path, this.__config);
253
+ initPath(this.__useEl, this.__path)
254
254
  full(this.__useEl, this.__config)
255
255
  return this
256
256
  }
@@ -2,6 +2,13 @@ import type SVGConfigType from '../../../types/SVGConfig'
2
2
 
3
3
  import { XLINK_ATTRIBUTE } from "./dictionary"
4
4
 
5
+ const setLineAttr = (el: SVGElement, config: SVGConfigType) => {
6
+ setAttribute(el, "stroke-dasharray", (config.lineDash as Array<number>).join(','))
7
+ setAttribute(el, "stroke-width", config.lineWidth + "")
8
+ setAttribute(el, "stroke-linecap", config.lineCap + "")
9
+ setAttribute(el, "stroke-linejoin", config.lineJoin + "")
10
+ }
11
+
5
12
  // 新建节点
6
13
  export function toNode(tagname: string) {
7
14
  return document.createElementNS('http://www.w3.org/2000/svg', tagname)
@@ -29,6 +36,7 @@ export function getAttribute(el: SVGElement, key: string) {
29
36
  }
30
37
 
31
38
  export function full(el: SVGElement, config: SVGConfigType) {
39
+ setLineAttr(el, config)
32
40
  _setAttribute(el, "stroke", config.strokeStyle as string)
33
41
  _setAttribute(el, "fill", config.fillStyle as string)
34
42
  }
@@ -38,6 +46,7 @@ export function fill(el: SVGElement, config: SVGConfigType) {
38
46
  }
39
47
 
40
48
  export function stroke(el: SVGElement, config: SVGConfigType) {
49
+ setLineAttr(el, config)
41
50
  _setAttribute(el, "stroke", config.strokeStyle as string)
42
51
  _setAttribute(el, "fill", "none")
43
52
  }
@@ -0,0 +1,81 @@
1
+ import type MapConfigType from '../../types/MapConfig'
2
+ import type MapCoordinateType from '../../types/MapCoordinate'
3
+ import type MapType from '../../types/Map'
4
+
5
+ import { initOption, mergeOption } from '../common/option'
6
+ import getBoundary from '../common/map/getBoundary'
7
+ import Mercator from '../Mercator'
8
+ import Eoap from '../Eoap'
9
+
10
+ class MapCoordinate implements MapCoordinateType {
11
+ readonly name: string = 'MapCoordinate'
12
+
13
+ private __config: MapConfigType
14
+ private __map: MapType
15
+ private __boundary: Array<number>
16
+
17
+ constructor(config: MapConfigType = {}) {
18
+ this.__config = initOption(config, {
19
+ api: "Mercator",
20
+ width: 400,
21
+ height: 300,
22
+ left: 0,
23
+ top: 0
24
+ })
25
+ }
26
+
27
+ private $$updateMap() {
28
+ let [minLongitude, maxLongitude, minLatitude, maxLatitude] = this.__boundary
29
+
30
+ if (this.__config.api == "Eoap") {
31
+
32
+ let xScale = (this.__config.width as number) * 0.836 / (maxLongitude - minLongitude)
33
+ let yScale = (this.__config.height as number) * 0.557 / (maxLatitude - minLatitude)
34
+
35
+ this.__map = new Eoap(xScale < yScale ? xScale : yScale, [
36
+ (minLongitude + maxLongitude) * 0.5 * 0.9778,
37
+ (minLatitude + maxLatitude) * 0.5 * 1.025
38
+ ])
39
+
40
+ } else if (this.__config.api == "Mercator") {
41
+
42
+ let xScale = (this.__config.width as number) * 0.72 / (maxLongitude - minLongitude)
43
+ let yScale = (this.__config.height as number) * 0.575 / (maxLatitude - minLatitude)
44
+
45
+ this.__map = new Mercator(xScale < yScale ? xScale : yScale, [
46
+ (minLongitude + maxLongitude) * 0.5,
47
+ (minLatitude + maxLatitude) * 0.5
48
+ ])
49
+
50
+ } else {
51
+ throw new Error("Unexpected API types:" + this.__config.api)
52
+ }
53
+ }
54
+
55
+ setConfig(config: MapConfigType) {
56
+ mergeOption(this.__config, config)
57
+ this.$$updateMap()
58
+ return this
59
+ }
60
+
61
+ setGeos(...geos: any[]) {
62
+ this.__boundary = getBoundary(...geos)
63
+ this.$$updateMap()
64
+ return this
65
+ }
66
+
67
+ use(λ: number, φ: number): [number, number] {
68
+ if (this.__map) {
69
+ let dxyz = this.__map.use(λ, φ)
70
+ return [
71
+ (this.__config.left as number) + (this.__config.width as number) * 0.5 + dxyz[0],
72
+ (this.__config.top as number) + (this.__config.height as number) * 0.5 + dxyz[1],
73
+ ]
74
+ } else {
75
+ throw new Error("Geographic data not set")
76
+ }
77
+ }
78
+
79
+ }
80
+
81
+ export default MapCoordinate
package/types/Canvas.d.ts CHANGED
@@ -241,6 +241,14 @@ export default interface CanvasType {
241
241
  */
242
242
  clearRect(x: number, y: number, w: number, h: number): this
243
243
 
244
+ /**
245
+ * 擦除画笔上的一个圆形区域
246
+ * @param cx 区域中心X坐标
247
+ * @param cy 区域中心Y坐标
248
+ * @param r 区域半径
249
+ */
250
+ clearCircle(cx: number, cy: number, r: number): this
251
+
244
252
  /**
245
253
  * 是否操作只影响区域
246
254
  */
@@ -59,61 +59,31 @@ export default interface CanvasConfigType {
59
59
  */
60
60
  fontSize?: number
61
61
 
62
- /**
63
- * 已废弃,向下兼容,请用 fontSize 代替
64
- */
65
- "font-size"?: number // 向下兼容
66
-
67
62
  /**
68
63
  * 字体,默认"sans-serif"
69
64
  */
70
65
  fontFamily?: string
71
66
 
72
- /**
73
- * 已废弃,向下兼容,请用 fontFamily 代替
74
- */
75
- "font-family"?: string // 向下兼容
76
-
77
67
  /**
78
68
  * 字重,默认400
79
69
  */
80
70
  fontWeight?: number
81
71
 
82
- /**
83
- * 已废弃,向下兼容,请用 fontWeight 代替
84
- */
85
- "font-weight"?: number // 向下兼容
86
-
87
72
  /**
88
73
  * 字类型,默认"normal"
89
74
  */
90
75
  fontStyle?: string
91
76
 
92
- /**
93
- * 已废弃,向下兼容,请用 fontStyle 代替
94
- */
95
- "font-style"?: string // 向下兼容
96
-
97
77
  /**
98
78
  * 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
99
79
  */
100
80
  arcStartCap?: arcCapType
101
81
 
102
- /**
103
- * 已废弃,向下兼容,请用 arcStartCap 代替
104
- */
105
- "arc-start-cap"?: string // 向下兼容
106
-
107
82
  /**
108
83
  * 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
109
84
  */
110
85
  arcEndCap?: arcCapType
111
86
 
112
- /**
113
- * 已废弃,向下兼容,请用 arcEndCap 代替
114
- */
115
- "arc-end-cap"?: string // 向下兼容
116
-
117
87
  // 矩形圆角半径
118
88
  rectRadius?: Array<number>
119
89
  }
@@ -0,0 +1,28 @@
1
+ export default interface MapConfigType {
2
+
3
+ /**
4
+ * 投影算法,默认Mercator,即墨卡托投影
5
+ */
6
+ api?: "Eoap" | "Mercator"
7
+
8
+ /**
9
+ * 地图宽
10
+ */
11
+ width?: number
12
+
13
+ /**
14
+ * 地图高
15
+ */
16
+ height?: number
17
+
18
+ /**
19
+ * 地图左上角横坐标
20
+ */
21
+ left?: number
22
+
23
+ /**
24
+ * 地图左上角枞坐标
25
+ */
26
+ top?: number
27
+
28
+ }
@@ -0,0 +1,23 @@
1
+ import MapConfigType from './MapConfig'
2
+
3
+ export default interface MapCoordinateType {
4
+
5
+ /**
6
+ * 修改配置
7
+ * @param config
8
+ */
9
+ setConfig(config: MapConfigType): this
10
+
11
+ /**
12
+ * 地理数据
13
+ * @param geos
14
+ */
15
+ setGeos(...geos: any[]): this
16
+
17
+ /**
18
+ * 返回该点的绘图坐标
19
+ * @param λ 经纬度
20
+ * @param φ
21
+ */
22
+ use(λ: number, φ: number): [number, number]
23
+ }
@@ -52,39 +52,21 @@ export default interface SVGConfigType {
52
52
  */
53
53
  fontSize?: number
54
54
 
55
- /**
56
- * 已废弃,向下兼容,请用 fontSize 代替
57
- */
58
- "font-size"?: number // 向下兼容
59
-
60
55
  /**
61
56
  * 字体,默认"sans-serif"
62
57
  */
63
58
  fontFamily?: string
64
59
 
65
- /**
66
- * 已废弃,向下兼容,请用 fontFamily 代替
67
- */
68
- "font-family"?: string // 向下兼容
69
-
70
60
  /**
71
61
  * 圆弧开始端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
72
62
  */
73
63
  arcStartCap?: arcCapType
74
64
 
75
- /**
76
- * 已废弃,向下兼容,请用 arcStartCap 代替
77
- */
78
- "arc-start-cap"?: string // 向下兼容
79
-
80
65
  /**
81
66
  * 圆弧结束端闭合方式,默认"butt"直线闭合(还有"round"圆帽闭合,"-round"反圆帽闭合)
82
67
  */
83
68
  arcEndCap?: arcCapType
84
69
 
85
- /**
86
- * 已废弃,向下兼容,请用 arcEndCap 代替
87
- */
88
- "arc-end-cap"?: string // 向下兼容
89
-
70
+ // 矩形圆角半径
71
+ rectRadius?: Array<number>
90
72
  }
package/types/index.d.ts CHANGED
@@ -27,8 +27,11 @@ import MapType from './Map'
27
27
  import throttleType from './throttle'
28
28
  import assembleType from './assemble'
29
29
 
30
- import TreeLayoutType from './TreeLayout'
30
+ import MapConfigType from './MapConfig'
31
+ import MapCoordinateType from './MapCoordinate'
32
+
31
33
  import TreeConfigType from './TreeConfig'
34
+ import TreeLayoutType from './TreeLayout'
32
35
 
33
36
  import { initOptionType, mergeOptionType } from './option'
34
37
 
@@ -75,6 +78,11 @@ interface NewMercatorType extends MapType {
75
78
  new(scale?: number, center?: number[]): this
76
79
  }
77
80
 
81
+ // 坐标系
82
+ interface NewMapCoordinateType extends MapCoordinateType {
83
+ new(config?: MapConfigType): this
84
+ }
85
+
78
86
  // 布局
79
87
  interface NewTreeLayoutType extends TreeLayoutType {
80
88
  new(config?: TreeConfigType): this
@@ -116,6 +124,9 @@ export default class VISLite {
116
124
  static throttle: throttleType
117
125
  static assemble: assembleType
118
126
 
127
+ // 坐标系
128
+ static MapCoordinate: NewMapCoordinateType
129
+
119
130
  // 布局
120
131
  static TreeLayout: NewTreeLayoutType
121
132
 
@@ -158,6 +169,9 @@ export let Mercator: NewMercatorType
158
169
  export let throttle: throttleType
159
170
  export let assemble: assembleType
160
171
 
172
+ // 坐标系
173
+ export let MapCoordinate: NewMapCoordinateType
174
+
161
175
  // 布局
162
176
  export let TreeLayout: NewTreeLayoutType
163
177