@antv/l7-layers 2.17.3 → 2.17.4
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/es/Geometry/index.js +31 -9
- package/es/Geometry/models/billboard.js +89 -51
- package/es/Geometry/models/plane.js +143 -81
- package/es/Geometry/models/sprite.js +118 -60
- package/es/canvas/index.js +33 -10
- package/es/canvas/models/canvas.js +97 -41
- package/es/citybuliding/building.js +27 -8
- package/es/citybuliding/models/build.js +82 -57
- package/es/core/BaseLayer.js +478 -313
- package/es/core/BaseModel.js +80 -51
- package/es/core/CommonStyleAttribute.js +5 -2
- package/es/core/LayerPickService.js +32 -21
- package/es/core/TextureService.js +13 -0
- package/es/core/interface.js +24 -17
- package/es/core/shape/Path.js +20 -13
- package/es/core/shape/extrude.js +39 -27
- package/es/core/triangulation.js +136 -99
- package/es/earth/index.js +33 -9
- package/es/earth/models/atmosphere.js +54 -30
- package/es/earth/models/base.js +85 -47
- package/es/earth/models/bloomsphere.js +54 -30
- package/es/earth/utils.js +13 -9
- package/es/heatmap/index.js +40 -10
- package/es/heatmap/models/grid.js +52 -28
- package/es/heatmap/models/grid3d.js +52 -28
- package/es/heatmap/models/heatmap.js +149 -92
- package/es/heatmap/models/hexagon.js +52 -28
- package/es/heatmap/triangulation.js +4 -0
- package/es/image/index.js +28 -9
- package/es/image/models/image.js +100 -66
- package/es/index.js +17 -9
- package/es/line/index.js +35 -9
- package/es/line/models/arc.js +112 -63
- package/es/line/models/arc_3d.js +102 -58
- package/es/line/models/earthArc_3d.js +105 -60
- package/es/line/models/flow.js +60 -36
- package/es/line/models/great_circle.js +94 -53
- package/es/line/models/line.js +136 -85
- package/es/line/models/linearline.js +74 -42
- package/es/line/models/simpleLine.js +67 -38
- package/es/line/models/wall.js +92 -52
- package/es/mask/index.js +28 -9
- package/es/mask/models/fill.js +54 -29
- package/es/plugins/DataMappingPlugin.js +114 -78
- package/es/plugins/DataSourcePlugin.js +68 -45
- package/es/plugins/FeatureScalePlugin.js +122 -67
- package/es/plugins/LayerAnimateStylePlugin.js +5 -0
- package/es/plugins/LayerMaskPlugin.js +11 -3
- package/es/plugins/LayerModelPlugin.js +108 -69
- package/es/plugins/LayerStylePlugin.js +9 -3
- package/es/plugins/LightingPlugin.js +18 -12
- package/es/plugins/MultiPassRendererPlugin.js +16 -11
- package/es/plugins/PixelPickingPlugin.js +21 -12
- package/es/plugins/RegisterStyleAttributePlugin.js +12 -5
- package/es/plugins/ShaderUniformPlugin.js +27 -13
- package/es/plugins/UpdateModelPlugin.js +5 -0
- package/es/plugins/UpdateStyleAttributePlugin.js +11 -5
- package/es/point/index.js +78 -26
- package/es/point/models/earthExtrude.js +95 -58
- package/es/point/models/earthFill.js +80 -52
- package/es/point/models/extrude.js +94 -57
- package/es/point/models/fill.js +81 -56
- package/es/point/models/fillmage.js +100 -60
- package/es/point/models/image.js +83 -47
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +54 -30
- package/es/point/models/radar.js +63 -38
- package/es/point/models/simplePoint.js +62 -38
- package/es/point/models/text.js +296 -199
- package/es/point/shape/extrude.js +13 -4
- package/es/polygon/index.js +41 -11
- package/es/polygon/models/extrude.js +135 -87
- package/es/polygon/models/fill.js +79 -50
- package/es/polygon/models/index.js +2 -3
- package/es/polygon/models/ocean.js +76 -42
- package/es/polygon/models/water.js +71 -37
- package/es/raster/buffers/triangulation.js +4 -2
- package/es/raster/index.js +32 -9
- package/es/raster/models/raster.js +116 -80
- package/es/raster/models/rasterRgb.js +127 -84
- package/es/raster/models/rasterTerrainRgb.js +84 -56
- package/es/tile/interaction/getRasterData.js +20 -14
- package/es/tile/interaction/utils.js +9 -7
- package/es/tile/manager/base.js +96 -63
- package/es/tile/service/TileLayerService.js +55 -33
- package/es/tile/service/TilePickService.js +40 -26
- package/es/tile/service/TileSourceService.js +7 -3
- package/es/tile/tileFactory/DebugTile.js +46 -29
- package/es/tile/tileFactory/ImageTile.js +38 -20
- package/es/tile/tileFactory/MaskTile.js +43 -22
- package/es/tile/tileFactory/RasterRGBTile.js +42 -22
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +38 -20
- package/es/tile/tileFactory/RasterTile.js +53 -30
- package/es/tile/tileFactory/Tile.js +97 -63
- package/es/tile/tileFactory/VectorTile.js +68 -41
- package/es/tile/tileFactory/index.js +11 -0
- package/es/tile/tileFactory/layers/TileDebugLayer.js +27 -6
- package/es/tile/tileFactory/util.js +3 -0
- package/es/tile/tileLayer/BaseLayer.js +146 -105
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +2 -0
- package/es/utils/collision-index.js +16 -9
- package/es/utils/extrude_polyline.js +149 -101
- package/es/utils/grid-index.js +27 -2
- package/es/utils/identityScale.js +8 -0
- package/es/utils/layerData.js +44 -30
- package/es/utils/multiPassRender.js +13 -11
- package/es/utils/polylineNormal.js +37 -31
- package/es/utils/simpleLine.js +16 -2
- package/es/utils/stencil.js +3 -2
- package/es/utils/symbol-layout.js +53 -27
- package/es/wind/index.js +29 -9
- package/es/wind/models/utils.js +51 -26
- package/es/wind/models/wind.js +147 -101
- package/es/wind/models/windRender.js +66 -53
- package/lib/Geometry/index.js +38 -9
- package/lib/Geometry/models/billboard.js +97 -51
- package/lib/Geometry/models/index.js +5 -0
- package/lib/Geometry/models/plane.js +151 -79
- package/lib/Geometry/models/sprite.js +127 -60
- package/lib/canvas/index.js +40 -10
- package/lib/canvas/models/canvas.js +101 -41
- package/lib/canvas/models/index.js +3 -0
- package/lib/citybuliding/building.js +35 -8
- package/lib/citybuliding/models/build.js +92 -57
- package/lib/core/BaseLayer.js +469 -313
- package/lib/core/BaseModel.js +90 -51
- package/lib/core/CommonStyleAttribute.js +7 -2
- package/lib/core/LayerPickService.js +37 -21
- package/lib/core/TextureService.js +16 -0
- package/lib/core/interface.js +31 -21
- package/lib/core/schema.js +1 -0
- package/lib/core/shape/Path.js +31 -14
- package/lib/core/shape/extrude.js +62 -27
- package/lib/core/triangulation.js +177 -98
- package/lib/earth/index.js +43 -9
- package/lib/earth/models/atmosphere.js +63 -30
- package/lib/earth/models/base.js +90 -47
- package/lib/earth/models/bloomsphere.js +63 -30
- package/lib/earth/utils.js +31 -7
- package/lib/heatmap/index.js +48 -10
- package/lib/heatmap/models/grid.js +60 -28
- package/lib/heatmap/models/grid3d.js +60 -28
- package/lib/heatmap/models/heatmap.js +166 -92
- package/lib/heatmap/models/hexagon.js +60 -28
- package/lib/heatmap/models/index.js +6 -0
- package/lib/heatmap/triangulation.js +5 -0
- package/lib/image/index.js +36 -9
- package/lib/image/models/image.js +109 -66
- package/lib/image/models/index.js +3 -0
- package/lib/index.js +61 -7
- package/lib/line/index.js +40 -9
- package/lib/line/models/arc.js +122 -61
- package/lib/line/models/arc_3d.js +113 -56
- package/lib/line/models/earthArc_3d.js +115 -58
- package/lib/line/models/flow.js +70 -36
- package/lib/line/models/great_circle.js +104 -53
- package/lib/line/models/index.js +11 -0
- package/lib/line/models/line.js +144 -83
- package/lib/line/models/linearline.js +86 -42
- package/lib/line/models/simpleLine.js +77 -38
- package/lib/line/models/wall.js +103 -52
- package/lib/mask/index.js +36 -9
- package/lib/mask/models/fill.js +63 -29
- package/lib/mask/models/index.js +3 -0
- package/lib/plugins/DataMappingPlugin.js +125 -78
- package/lib/plugins/DataSourcePlugin.js +76 -45
- package/lib/plugins/FeatureScalePlugin.js +138 -67
- package/lib/plugins/LayerAnimateStylePlugin.js +10 -0
- package/lib/plugins/LayerMaskPlugin.js +17 -4
- package/lib/plugins/LayerModelPlugin.js +117 -70
- package/lib/plugins/LayerStylePlugin.js +14 -4
- package/lib/plugins/LightingPlugin.js +25 -12
- package/lib/plugins/MultiPassRendererPlugin.js +22 -11
- package/lib/plugins/PixelPickingPlugin.js +27 -12
- package/lib/plugins/RegisterStyleAttributePlugin.js +19 -5
- package/lib/plugins/ShaderUniformPlugin.js +34 -13
- package/lib/plugins/UpdateModelPlugin.js +10 -1
- package/lib/plugins/UpdateStyleAttributePlugin.js +16 -5
- package/lib/point/index.js +83 -26
- package/lib/point/models/earthExtrude.js +106 -58
- package/lib/point/models/earthFill.js +110 -52
- package/lib/point/models/extrude.js +103 -57
- package/lib/point/models/fill.js +90 -54
- package/lib/point/models/fillmage.js +107 -58
- package/lib/point/models/image.js +92 -47
- package/lib/point/models/index.js +12 -1
- package/lib/point/models/normal.js +64 -30
- package/lib/point/models/radar.js +72 -38
- package/lib/point/models/simplePoint.js +72 -38
- package/lib/point/models/text.js +305 -199
- package/lib/point/shape/extrude.js +20 -4
- package/lib/polygon/index.js +48 -11
- package/lib/polygon/models/extrude.js +146 -87
- package/lib/polygon/models/fill.js +89 -50
- package/lib/polygon/models/index.js +14 -2
- package/lib/polygon/models/ocean.js +88 -42
- package/lib/polygon/models/water.js +82 -37
- package/lib/raster/buffers/triangulation.js +7 -3
- package/lib/raster/index.js +40 -9
- package/lib/raster/models/index.js +5 -0
- package/lib/raster/models/raster.js +125 -80
- package/lib/raster/models/rasterRgb.js +139 -84
- package/lib/raster/models/rasterTerrainRgb.js +93 -56
- package/lib/tile/interaction/getRasterData.js +25 -14
- package/lib/tile/interaction/utils.js +19 -7
- package/lib/tile/manager/base.js +104 -63
- package/lib/tile/service/TileLayerService.js +60 -33
- package/lib/tile/service/TilePickService.js +48 -26
- package/lib/tile/service/TileSourceService.js +16 -2
- package/lib/tile/style/utils.js +3 -0
- package/lib/tile/tileFactory/DebugTile.js +54 -29
- package/lib/tile/tileFactory/ImageTile.js +46 -20
- package/lib/tile/tileFactory/MaskTile.js +51 -22
- package/lib/tile/tileFactory/RasterRGBTile.js +50 -22
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +46 -20
- package/lib/tile/tileFactory/RasterTile.js +63 -30
- package/lib/tile/tileFactory/Tile.js +102 -63
- package/lib/tile/tileFactory/VectorTile.js +76 -41
- package/lib/tile/tileFactory/index.js +25 -0
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +32 -6
- package/lib/tile/tileFactory/util.js +9 -0
- package/lib/tile/tileLayer/BaseLayer.js +153 -105
- package/lib/tile/utils.js +5 -1
- package/lib/utils/blend.js +5 -0
- package/lib/utils/collision-index.js +25 -9
- package/lib/utils/extrude_polyline.js +181 -101
- package/lib/utils/grid-index.js +28 -2
- package/lib/utils/identityScale.js +9 -0
- package/lib/utils/layerData.js +49 -30
- package/lib/utils/multiPassRender.js +16 -11
- package/lib/utils/polylineNormal.js +66 -31
- package/lib/utils/simpleLine.js +21 -2
- package/lib/utils/stencil.js +4 -0
- package/lib/utils/symbol-layout.js +55 -27
- package/lib/wind/index.js +37 -9
- package/lib/wind/models/index.js +3 -0
- package/lib/wind/models/utils.js +62 -26
- package/lib/wind/models/wind.js +157 -101
- package/lib/wind/models/windRender.js +71 -53
- package/lib/wind/models/windShader.js +1 -0
- package/package.json +7 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
@@ -8,53 +9,77 @@ exports.computeMiter = computeMiter;
|
|
|
8
9
|
exports.computeNormal = computeNormal;
|
|
9
10
|
exports.default = _default;
|
|
10
11
|
exports.direction = direction;
|
|
12
|
+
|
|
11
13
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
14
|
+
|
|
12
15
|
var _l7Utils = require("@antv/l7-utils");
|
|
16
|
+
|
|
13
17
|
var _glMatrix = require("gl-matrix");
|
|
18
|
+
|
|
14
19
|
function computeMiter(tangent, miter, lineA, lineB, halfThick) {
|
|
15
20
|
_glMatrix.vec2.add(tangent, lineA, lineB);
|
|
21
|
+
|
|
16
22
|
_glMatrix.vec2.normalize(tangent, tangent);
|
|
23
|
+
|
|
17
24
|
miter = _glMatrix.vec2.fromValues(-tangent[1], tangent[0]);
|
|
25
|
+
|
|
18
26
|
var tmp = _glMatrix.vec2.fromValues(-lineA[1], lineA[0]);
|
|
27
|
+
|
|
19
28
|
return halfThick / _glMatrix.vec2.dot(miter, tmp);
|
|
20
29
|
}
|
|
30
|
+
|
|
21
31
|
function computeNormal(out, dir) {
|
|
22
32
|
return _glMatrix.vec2.set(out, -dir[1], dir[0]);
|
|
23
33
|
}
|
|
34
|
+
|
|
24
35
|
function direction(out, a, b) {
|
|
25
36
|
// const a1 = aProjectFlat([a[0], a[1]]) as [number, number];
|
|
26
37
|
// const b1 = aProjectFlat([b[0], b[1]]) as [number, number];
|
|
27
38
|
_glMatrix.vec2.sub(out, a, b);
|
|
39
|
+
|
|
28
40
|
_glMatrix.vec2.normalize(out, out);
|
|
41
|
+
|
|
29
42
|
return out;
|
|
30
43
|
}
|
|
44
|
+
|
|
31
45
|
function extrusions(positions, out, miters, point, normal, scale) {
|
|
32
46
|
addNext(out, miters, normal, -scale);
|
|
33
47
|
addNext(out, miters, normal, scale);
|
|
34
48
|
positions.push(point[0], point[1], 0);
|
|
35
49
|
positions.push(point[0], point[1], 0);
|
|
36
50
|
}
|
|
51
|
+
|
|
37
52
|
function addNext(out, miters, normal, length) {
|
|
38
53
|
out.push(normal[0], normal[1], 0);
|
|
39
54
|
miters.push(length);
|
|
40
55
|
}
|
|
56
|
+
|
|
41
57
|
function lineSegmentDistance(b1, a1) {
|
|
42
58
|
var dx = a1[0] - b1[0];
|
|
43
59
|
var dy = a1[1] - b1[1];
|
|
44
60
|
return Math.sqrt(dx * dx + dy * dy);
|
|
45
61
|
}
|
|
62
|
+
|
|
46
63
|
function isPointEqual(a, b) {
|
|
47
64
|
return a[0] === b[0] && a[1] === b[1];
|
|
48
65
|
}
|
|
66
|
+
|
|
49
67
|
function _default(points, closed, indexOffset) {
|
|
50
68
|
var isDash = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
69
|
+
|
|
51
70
|
var lineA = _glMatrix.vec2.fromValues(0, 0);
|
|
71
|
+
|
|
52
72
|
var lineB = _glMatrix.vec2.fromValues(0, 0);
|
|
73
|
+
|
|
53
74
|
var tangent = _glMatrix.vec2.fromValues(0, 0);
|
|
75
|
+
|
|
54
76
|
var miter = _glMatrix.vec2.create();
|
|
77
|
+
|
|
55
78
|
var started = false;
|
|
56
79
|
var lineNormal = null;
|
|
80
|
+
|
|
57
81
|
var tmp = _glMatrix.vec2.create();
|
|
82
|
+
|
|
58
83
|
var count = indexOffset || 0;
|
|
59
84
|
var miterLimit = 4;
|
|
60
85
|
var out = [];
|
|
@@ -62,46 +87,58 @@ function _default(points, closed, indexOffset) {
|
|
|
62
87
|
var attrIndex = [];
|
|
63
88
|
var miters = [];
|
|
64
89
|
var attrDistance = [0, 0];
|
|
90
|
+
|
|
65
91
|
if (closed) {
|
|
66
92
|
points = points.slice();
|
|
67
93
|
points.push(points[0]);
|
|
68
94
|
}
|
|
95
|
+
|
|
69
96
|
var total = points.length;
|
|
97
|
+
|
|
70
98
|
for (var i = 1; i < total; i++) {
|
|
71
99
|
var index = count;
|
|
100
|
+
|
|
72
101
|
var last = _glMatrix.vec2.fromValues(points[i - 1][0], points[i - 1][1]);
|
|
102
|
+
|
|
73
103
|
var cur = _glMatrix.vec2.fromValues(points[i][0], points[i][1]);
|
|
74
|
-
|
|
75
|
-
// 如果当前点和前一点相同,跳过
|
|
104
|
+
|
|
105
|
+
var next = i < points.length - 1 ? _glMatrix.vec2.fromValues(points[i + 1][0], points[i + 1][1]) : null; // 如果当前点和前一点相同,跳过
|
|
106
|
+
|
|
76
107
|
if (isPointEqual(last, cur)) {
|
|
77
108
|
continue;
|
|
78
109
|
}
|
|
110
|
+
|
|
79
111
|
if (next) {
|
|
80
|
-
var nextIndex = i + 1;
|
|
81
|
-
|
|
112
|
+
var nextIndex = i + 1; // 找到不相同的下一点
|
|
113
|
+
|
|
82
114
|
while (next && isPointEqual(cur, next)) {
|
|
83
115
|
next = nextIndex < points.length - 1 ? _glMatrix.vec2.fromValues(points[++nextIndex][0], points[nextIndex][1]) : null;
|
|
84
116
|
}
|
|
85
117
|
}
|
|
118
|
+
|
|
86
119
|
var d = 0;
|
|
87
120
|
var flatCur = (0, _l7Utils.aProjectFlat)([cur[0], cur[1]]);
|
|
88
121
|
var flatLast = (0, _l7Utils.aProjectFlat)([last[0], last[1]]);
|
|
122
|
+
|
|
89
123
|
if (isDash) {
|
|
90
124
|
var lineDistance = lineSegmentDistance(flatCur, flatLast);
|
|
91
125
|
d = lineDistance + attrDistance[attrDistance.length - 1];
|
|
92
126
|
}
|
|
127
|
+
|
|
93
128
|
direction(lineA, flatCur, flatLast);
|
|
129
|
+
|
|
94
130
|
if (!lineNormal) {
|
|
95
131
|
lineNormal = _glMatrix.vec2.create();
|
|
96
132
|
computeNormal(lineNormal, lineA);
|
|
97
133
|
}
|
|
134
|
+
|
|
98
135
|
if (!started) {
|
|
99
136
|
started = true;
|
|
100
137
|
extrusions(attrPos, out, miters, last, lineNormal, 1);
|
|
101
138
|
}
|
|
102
|
-
attrIndex.push(index + 0, index + 2, index + 1);
|
|
103
139
|
|
|
104
|
-
// no miter, simple segment
|
|
140
|
+
attrIndex.push(index + 0, index + 2, index + 1); // no miter, simple segment
|
|
141
|
+
|
|
105
142
|
if (!next) {
|
|
106
143
|
// reset normal
|
|
107
144
|
computeNormal(lineNormal, lineA);
|
|
@@ -110,18 +147,14 @@ function _default(points, closed, indexOffset) {
|
|
|
110
147
|
attrIndex.push(index + 1, index + 2, index + 3);
|
|
111
148
|
count += 2;
|
|
112
149
|
} else {
|
|
113
|
-
var flatNext = (0, _l7Utils.aProjectFlat)([next[0], next[1]]);
|
|
114
|
-
// get unit dir of next line
|
|
115
|
-
direction(lineB, flatNext, flatCur);
|
|
150
|
+
var flatNext = (0, _l7Utils.aProjectFlat)([next[0], next[1]]); // get unit dir of next line
|
|
116
151
|
|
|
117
|
-
// stores tangent & miter
|
|
118
|
-
var miterLen = computeMiter(tangent, _glMatrix.vec2.fromValues(miter[0], miter[1]), lineA, lineB, 1);
|
|
152
|
+
direction(lineB, flatNext, flatCur); // stores tangent & miter
|
|
119
153
|
|
|
120
|
-
// get orientation
|
|
121
|
-
var flip = _glMatrix.vec2.dot(tangent, lineNormal) < 0 ? -1 : 1;
|
|
122
|
-
var bevel = Math.abs(miterLen) > miterLimit;
|
|
154
|
+
var miterLen = computeMiter(tangent, _glMatrix.vec2.fromValues(miter[0], miter[1]), lineA, lineB, 1); // get orientation
|
|
123
155
|
|
|
124
|
-
|
|
156
|
+
var flip = _glMatrix.vec2.dot(tangent, lineNormal) < 0 ? -1 : 1;
|
|
157
|
+
var bevel = Math.abs(miterLen) > miterLimit; // 处理前后两条线段重合的情况,这种情况不需要使用任何接头(miter/bevel)。
|
|
125
158
|
// 理论上这种情况下 miterLen = Infinity,本应通过 isFinite(miterLen) 判断,
|
|
126
159
|
// 但是 AMap 投影变换后丢失精度,只能通过一个阈值(1000)判断。
|
|
127
160
|
|
|
@@ -130,58 +163,60 @@ function _default(points, closed, indexOffset) {
|
|
|
130
163
|
attrIndex.push(index + 1, index + 2, index + 3);
|
|
131
164
|
attrIndex.push(index + 2, index + 4, index + 3);
|
|
132
165
|
computeNormal(tmp, lineB);
|
|
166
|
+
|
|
133
167
|
_glMatrix.vec2.copy(lineNormal, tmp); // store normal for next round
|
|
134
168
|
|
|
169
|
+
|
|
135
170
|
extrusions(attrPos, out, miters, cur, lineNormal, 1);
|
|
136
|
-
attrDistance.push(d, d, d, d);
|
|
171
|
+
attrDistance.push(d, d, d, d); // the miter is now the normal for our next join
|
|
137
172
|
|
|
138
|
-
// the miter is now the normal for our next join
|
|
139
173
|
count += 4;
|
|
140
174
|
continue;
|
|
141
175
|
}
|
|
176
|
+
|
|
142
177
|
if (bevel) {
|
|
143
|
-
miterLen = miterLimit;
|
|
178
|
+
miterLen = miterLimit; // next two points in our first segment
|
|
144
179
|
|
|
145
|
-
// next two points in our first segment
|
|
146
180
|
extrusions(attrPos, out, miters, cur, lineNormal, 1);
|
|
147
|
-
attrIndex.push(index + 1, index + 2, index + 3);
|
|
181
|
+
attrIndex.push(index + 1, index + 2, index + 3); // now add the bevel triangle
|
|
148
182
|
|
|
149
|
-
// now add the bevel triangle
|
|
150
183
|
attrIndex.push.apply(attrIndex, (0, _toConsumableArray2.default)(flip === 1 ? [index + 2, index + 4, index + 5] : [index + 4, index + 5, index + 3]));
|
|
151
184
|
computeNormal(tmp, lineB);
|
|
185
|
+
|
|
152
186
|
_glMatrix.vec2.copy(lineNormal, tmp); // store normal for next round
|
|
153
187
|
|
|
188
|
+
|
|
154
189
|
extrusions(attrPos, out, miters, cur, lineNormal, 1);
|
|
155
|
-
attrDistance.push(d, d, d, d);
|
|
190
|
+
attrDistance.push(d, d, d, d); // the miter is now the normal for our next join
|
|
156
191
|
|
|
157
|
-
// the miter is now the normal for our next join
|
|
158
192
|
count += 4;
|
|
159
193
|
} else {
|
|
160
194
|
// next two points in our first segment
|
|
161
195
|
extrusions(attrPos, out, miters, cur, lineNormal, 1);
|
|
162
|
-
attrIndex.push(index + 1, index + 2, index + 3);
|
|
196
|
+
attrIndex.push(index + 1, index + 2, index + 3); // now add the miter triangles
|
|
163
197
|
|
|
164
|
-
// now add the miter triangles
|
|
165
198
|
addNext(out, miters, lineNormal, miterLen * -flip);
|
|
166
199
|
attrPos.push(cur[0], cur[1], 0);
|
|
167
200
|
attrIndex.push(index + 2, index + 4, index + 3);
|
|
168
201
|
attrIndex.push(index + 4, index + 5, index + 6);
|
|
169
202
|
computeNormal(tmp, lineB);
|
|
203
|
+
|
|
170
204
|
_glMatrix.vec2.copy(lineNormal, tmp); // store normal for next round
|
|
171
205
|
|
|
206
|
+
|
|
172
207
|
extrusions(attrPos, out, miters, cur, lineNormal, 1);
|
|
173
|
-
attrDistance.push(d, d, d, d, d);
|
|
208
|
+
attrDistance.push(d, d, d, d, d); // the miter is now the normal for our next join
|
|
174
209
|
|
|
175
|
-
// the miter is now the normal for our next join
|
|
176
210
|
count += 5;
|
|
177
211
|
}
|
|
178
212
|
}
|
|
179
213
|
}
|
|
214
|
+
|
|
180
215
|
var pickData = [];
|
|
216
|
+
|
|
181
217
|
for (var _i = 0; _i < miters.length; _i++) {
|
|
182
218
|
var totalDistance = attrDistance[attrDistance.length - 1];
|
|
183
|
-
pickData.push(attrPos[_i * 3], attrPos[_i * 3 + 1], attrPos[_i * 3 + 2], attrDistance[_i],
|
|
184
|
-
// dash
|
|
219
|
+
pickData.push(attrPos[_i * 3], attrPos[_i * 3 + 1], attrPos[_i * 3 + 2], attrDistance[_i], // dash
|
|
185
220
|
miters[_i], totalDistance // dash
|
|
186
221
|
);
|
|
187
222
|
}
|
|
@@ -190,6 +225,6 @@ function _default(points, closed, indexOffset) {
|
|
|
190
225
|
normals: out,
|
|
191
226
|
attrIndex: attrIndex,
|
|
192
227
|
attrPos: pickData // [x,y,z, distance, miter ,t0tal ]
|
|
228
|
+
|
|
193
229
|
};
|
|
194
|
-
}
|
|
195
|
-
// [x,y,z, distance, miter ]
|
|
230
|
+
} // [x,y,z, distance, miter ]
|
package/lib/utils/simpleLine.js
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
9
|
exports.direction = direction;
|
|
10
|
+
|
|
9
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
|
|
10
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
|
+
|
|
11
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
|
|
12
17
|
var _l7Utils = require("@antv/l7-utils");
|
|
18
|
+
|
|
13
19
|
var _glMatrix = require("gl-matrix");
|
|
20
|
+
|
|
14
21
|
var lineA = _glMatrix.vec2.create();
|
|
22
|
+
|
|
15
23
|
function direction(out, a, b) {
|
|
16
24
|
_glMatrix.vec2.sub(out, a, b);
|
|
25
|
+
|
|
17
26
|
_glMatrix.vec2.normalize(out, out);
|
|
27
|
+
|
|
18
28
|
return out;
|
|
19
29
|
}
|
|
30
|
+
|
|
20
31
|
var ExtrudePolyline = /*#__PURE__*/function () {
|
|
21
32
|
function ExtrudePolyline() {
|
|
22
33
|
(0, _classCallCheck2.default)(this, ExtrudePolyline);
|
|
@@ -30,26 +41,32 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
30
41
|
indexes: []
|
|
31
42
|
};
|
|
32
43
|
}
|
|
44
|
+
|
|
33
45
|
(0, _createClass2.default)(ExtrudePolyline, [{
|
|
34
46
|
key: "simpleExtrude",
|
|
35
47
|
value: function simpleExtrude(points) {
|
|
36
48
|
var complex = this.complex;
|
|
49
|
+
|
|
37
50
|
if (points.length <= 1) {
|
|
38
51
|
return complex;
|
|
39
52
|
}
|
|
53
|
+
|
|
40
54
|
this.started = false;
|
|
41
55
|
this.totalDistance = 0;
|
|
42
56
|
var total = points.length;
|
|
43
57
|
var count = complex.startIndex;
|
|
58
|
+
|
|
44
59
|
for (var i = 1; i < total; i++) {
|
|
45
60
|
var last = points[i - 1];
|
|
46
61
|
var cur = points[i];
|
|
47
62
|
var amt = this.simpleSegment(complex, count, last, cur);
|
|
48
63
|
count += amt;
|
|
49
64
|
}
|
|
65
|
+
|
|
50
66
|
for (var _i = 0; _i < complex.positions.length / 6; _i++) {
|
|
51
67
|
complex.positions[_i * 6 + 5] = this.totalDistance;
|
|
52
68
|
}
|
|
69
|
+
|
|
53
70
|
return complex;
|
|
54
71
|
}
|
|
55
72
|
}, {
|
|
@@ -63,10 +80,12 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
63
80
|
direction(lineA, flatCur, flatLast);
|
|
64
81
|
var segmentDistance = this.lineSegmentDistance(flatCur, flatLast);
|
|
65
82
|
this.totalDistance += segmentDistance;
|
|
83
|
+
|
|
66
84
|
if (!this.started) {
|
|
67
85
|
this.started = true;
|
|
68
86
|
this.extrusions(positions, last, this.totalDistance - segmentDistance);
|
|
69
87
|
}
|
|
88
|
+
|
|
70
89
|
this.extrusions(positions, cur, this.totalDistance);
|
|
71
90
|
indices.push(index + 0, index + 1, index + 2);
|
|
72
91
|
indices.push(index + 2, index + 1, index + 3);
|
|
@@ -75,8 +94,7 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
75
94
|
}
|
|
76
95
|
}, {
|
|
77
96
|
key: "extrusions",
|
|
78
|
-
value: function extrusions(positions, point,
|
|
79
|
-
// 顶点
|
|
97
|
+
value: function extrusions(positions, point, // 顶点
|
|
80
98
|
distanceRadio) {
|
|
81
99
|
positions.push(point[0], point[1], point[2] | 0, distanceRadio, 0, point[2] | 0);
|
|
82
100
|
this.complex.indexes.push(this.currentIndex);
|
|
@@ -94,4 +112,5 @@ var ExtrudePolyline = /*#__PURE__*/function () {
|
|
|
94
112
|
}]);
|
|
95
113
|
return ExtrudePolyline;
|
|
96
114
|
}();
|
|
115
|
+
|
|
97
116
|
exports.default = ExtrudePolyline;
|
package/lib/utils/stencil.js
CHANGED
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getStencil = getStencil;
|
|
7
7
|
exports.getStencilMask = getStencilMask;
|
|
8
|
+
|
|
8
9
|
var _l7Core = require("@antv/l7-core");
|
|
10
|
+
|
|
9
11
|
// 掩膜配置
|
|
10
12
|
function getStencil(mask, maskInside) {
|
|
11
13
|
return {
|
|
@@ -19,6 +21,7 @@ function getStencil(mask, maskInside) {
|
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
23
|
}
|
|
24
|
+
|
|
22
25
|
// 模版配置
|
|
23
26
|
function getStencilMask(option) {
|
|
24
27
|
if (option.maskOperation === _l7Core.MaskOperation.OR) {
|
|
@@ -37,6 +40,7 @@ function getStencilMask(option) {
|
|
|
37
40
|
}
|
|
38
41
|
};
|
|
39
42
|
}
|
|
43
|
+
|
|
40
44
|
return {
|
|
41
45
|
enable: true,
|
|
42
46
|
mask: 0xff,
|
|
@@ -5,9 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getGlyphQuads = getGlyphQuads;
|
|
7
7
|
exports.shapeText = shapeText;
|
|
8
|
+
|
|
8
9
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
|
+
|
|
9
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
|
+
|
|
11
15
|
/**
|
|
12
16
|
* 返回文本相对锚点位置
|
|
13
17
|
* @param {string} anchor 锚点位置
|
|
@@ -16,64 +20,76 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
16
20
|
function getAnchorAlignment(anchor) {
|
|
17
21
|
var horizontalAlign = 0.5;
|
|
18
22
|
var verticalAlign = 0.5;
|
|
23
|
+
|
|
19
24
|
switch (anchor) {
|
|
20
25
|
case 'right':
|
|
21
26
|
case 'top-right':
|
|
22
27
|
case 'bottom-right':
|
|
23
28
|
horizontalAlign = 1;
|
|
24
29
|
break;
|
|
30
|
+
|
|
25
31
|
case 'left':
|
|
26
32
|
case 'top-left':
|
|
27
33
|
case 'bottom-left':
|
|
28
34
|
horizontalAlign = 0;
|
|
29
35
|
break;
|
|
36
|
+
|
|
30
37
|
default:
|
|
31
38
|
horizontalAlign = 0.5;
|
|
32
39
|
}
|
|
40
|
+
|
|
33
41
|
switch (anchor) {
|
|
34
42
|
case 'bottom':
|
|
35
43
|
case 'bottom-right':
|
|
36
44
|
case 'bottom-left':
|
|
37
45
|
verticalAlign = 1;
|
|
38
46
|
break;
|
|
47
|
+
|
|
39
48
|
case 'top':
|
|
40
49
|
case 'top-right':
|
|
41
50
|
case 'top-left':
|
|
42
51
|
verticalAlign = 0;
|
|
43
52
|
break;
|
|
53
|
+
|
|
44
54
|
default:
|
|
45
55
|
verticalAlign = 0.5;
|
|
46
56
|
}
|
|
57
|
+
|
|
47
58
|
return {
|
|
48
59
|
horizontalAlign: horizontalAlign,
|
|
49
60
|
verticalAlign: verticalAlign
|
|
50
61
|
};
|
|
51
|
-
}
|
|
62
|
+
} // justify right = 1, left = 0, center = 0.5
|
|
63
|
+
|
|
52
64
|
|
|
53
|
-
// justify right = 1, left = 0, center = 0.5
|
|
54
65
|
function justifyLine(positionedGlyphs, glyphMap, start, end, justify) {
|
|
55
66
|
if (!justify) {
|
|
56
67
|
return;
|
|
57
68
|
}
|
|
69
|
+
|
|
58
70
|
var lastPositionedGlyph = positionedGlyphs[end];
|
|
59
71
|
var glyph = lastPositionedGlyph.glyph;
|
|
72
|
+
|
|
60
73
|
if (glyph) {
|
|
61
74
|
var lastAdvance = glyphMap[glyph].advance * lastPositionedGlyph.scale;
|
|
62
75
|
var lineIndent = (positionedGlyphs[end].x + lastAdvance) * justify;
|
|
76
|
+
|
|
63
77
|
for (var j = start; j <= end; j++) {
|
|
64
78
|
positionedGlyphs[j].x -= lineIndent;
|
|
65
79
|
}
|
|
66
80
|
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// justify right=1 left=0 center=0.5
|
|
81
|
+
} // justify right=1 left=0 center=0.5
|
|
70
82
|
// horizontalAlign right=1 left=0 center=0.5
|
|
71
83
|
// verticalAlign right=1 left=0 center=0.5
|
|
84
|
+
|
|
85
|
+
|
|
72
86
|
function align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, lineCount) {
|
|
73
87
|
var shiftX = (justify - horizontalAlign) * maxLineLength;
|
|
74
88
|
var shiftY = (-verticalAlign * lineCount + 0.5) * lineHeight;
|
|
89
|
+
|
|
75
90
|
var _iterator = _createForOfIteratorHelper(positionedGlyphs),
|
|
76
|
-
|
|
91
|
+
_step;
|
|
92
|
+
|
|
77
93
|
try {
|
|
78
94
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
79
95
|
var glyphs = _step.value;
|
|
@@ -86,6 +102,7 @@ function align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLin
|
|
|
86
102
|
_iterator.f();
|
|
87
103
|
}
|
|
88
104
|
}
|
|
105
|
+
|
|
89
106
|
function shapeLines(shaping, glyphMap, lines, lineHeight, textAnchor, textJustify, spacing) {
|
|
90
107
|
// buffer 为 4
|
|
91
108
|
var yOffset = -8;
|
|
@@ -99,6 +116,7 @@ function shapeLines(shaping, glyphMap, lines, lineHeight, textAnchor, textJustif
|
|
|
99
116
|
line.split('').forEach(function (char) {
|
|
100
117
|
var glyph = glyphMap[char];
|
|
101
118
|
var baselineOffset = 0;
|
|
119
|
+
|
|
102
120
|
if (glyph) {
|
|
103
121
|
positionedGlyphs.push({
|
|
104
122
|
glyph: char,
|
|
@@ -111,29 +129,31 @@ function shapeLines(shaping, glyphMap, lines, lineHeight, textAnchor, textJustif
|
|
|
111
129
|
});
|
|
112
130
|
x += glyph.advance + spacing;
|
|
113
131
|
}
|
|
114
|
-
});
|
|
132
|
+
}); // 左右对齐
|
|
115
133
|
|
|
116
|
-
// 左右对齐
|
|
117
134
|
if (positionedGlyphs.length !== lineStartIndex) {
|
|
118
135
|
var lineLength = x - spacing;
|
|
119
136
|
maxLineLength = Math.max(lineLength, maxLineLength);
|
|
120
137
|
justifyLine(positionedGlyphs, glyphMap, lineStartIndex, positionedGlyphs.length - 1, justify);
|
|
121
138
|
}
|
|
139
|
+
|
|
122
140
|
x = 0;
|
|
123
141
|
y -= lineHeight + 5;
|
|
124
142
|
});
|
|
143
|
+
|
|
125
144
|
var _getAnchorAlignment = getAnchorAlignment(textAnchor),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
horizontalAlign = _getAnchorAlignment.horizontalAlign,
|
|
146
|
+
verticalAlign = _getAnchorAlignment.verticalAlign;
|
|
147
|
+
|
|
148
|
+
align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, lines.length); // 计算包围盒
|
|
129
149
|
|
|
130
|
-
// 计算包围盒
|
|
131
150
|
var height = y - yOffset;
|
|
132
151
|
shaping.top += -verticalAlign * height;
|
|
133
152
|
shaping.bottom = shaping.top - height;
|
|
134
153
|
shaping.left += -horizontalAlign * maxLineLength;
|
|
135
154
|
shaping.right = shaping.left + maxLineLength;
|
|
136
155
|
}
|
|
156
|
+
|
|
137
157
|
function shapeIconFont(shaping, glyphMap, iconfonts, lineHeight, textAnchor, textJustify, spacing) {
|
|
138
158
|
// buffer 为 4
|
|
139
159
|
var yOffset = -8;
|
|
@@ -146,10 +166,12 @@ function shapeIconFont(shaping, glyphMap, iconfonts, lineHeight, textAnchor, tex
|
|
|
146
166
|
iconfonts.forEach(function (iconfont) {
|
|
147
167
|
var glyph = glyphMap[iconfont];
|
|
148
168
|
var baselineOffset = 0;
|
|
169
|
+
|
|
149
170
|
if (glyph) {
|
|
150
171
|
positionedGlyphs.push({
|
|
151
172
|
glyph: iconfont,
|
|
152
173
|
// x,
|
|
174
|
+
|
|
153
175
|
/**
|
|
154
176
|
* iconfont
|
|
155
177
|
* 在计算大小的时候计算的是 unicode 字符 如 
|
|
@@ -163,30 +185,31 @@ function shapeIconFont(shaping, glyphMap, iconfonts, lineHeight, textAnchor, tex
|
|
|
163
185
|
metrics: glyph
|
|
164
186
|
});
|
|
165
187
|
x += glyph.advance + spacing;
|
|
166
|
-
}
|
|
188
|
+
} // 左右对齐
|
|
189
|
+
|
|
167
190
|
|
|
168
|
-
// 左右对齐
|
|
169
191
|
if (positionedGlyphs.length !== lineStartIndex) {
|
|
170
192
|
var lineLength = x - spacing;
|
|
171
193
|
maxLineLength = Math.max(lineLength, maxLineLength);
|
|
172
194
|
justifyLine(positionedGlyphs, glyphMap, lineStartIndex, positionedGlyphs.length - 1, justify);
|
|
173
195
|
}
|
|
196
|
+
|
|
174
197
|
x = 0;
|
|
175
198
|
y -= lineHeight + 5;
|
|
176
199
|
});
|
|
200
|
+
|
|
177
201
|
var _getAnchorAlignment2 = getAnchorAlignment(textAnchor),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
202
|
+
horizontalAlign = _getAnchorAlignment2.horizontalAlign,
|
|
203
|
+
verticalAlign = _getAnchorAlignment2.verticalAlign;
|
|
204
|
+
|
|
205
|
+
align(positionedGlyphs, justify, horizontalAlign, verticalAlign, maxLineLength, lineHeight, iconfonts.length); // 计算包围盒
|
|
181
206
|
|
|
182
|
-
// 计算包围盒
|
|
183
207
|
var height = y - yOffset;
|
|
184
208
|
shaping.top += -verticalAlign * height;
|
|
185
209
|
shaping.bottom = shaping.top - height;
|
|
186
210
|
shaping.left += -horizontalAlign * maxLineLength;
|
|
187
211
|
shaping.right = shaping.left + maxLineLength;
|
|
188
212
|
}
|
|
189
|
-
|
|
190
213
|
/**
|
|
191
214
|
* 计算文本中每个独立字符相对锚点的位置
|
|
192
215
|
*
|
|
@@ -200,6 +223,8 @@ function shapeIconFont(shaping, glyphMap, iconfonts, lineHeight, textAnchor, tex
|
|
|
200
223
|
* @param {[boolean]} isIconFont 是否是 iconfont
|
|
201
224
|
* @return {boolean|shaping} 每个字符相对于锚点的位置
|
|
202
225
|
*/
|
|
226
|
+
|
|
227
|
+
|
|
203
228
|
function shapeText(text, glyphs, lineHeight, textAnchor, textJustify, spacing) {
|
|
204
229
|
var translate = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [0, 0];
|
|
205
230
|
var isIconFont = arguments.length > 7 ? arguments[7] : undefined;
|
|
@@ -216,25 +241,29 @@ function shapeText(text, glyphs, lineHeight, textAnchor, textJustify, spacing) {
|
|
|
216
241
|
text: text
|
|
217
242
|
};
|
|
218
243
|
isIconFont ? shapeIconFont(shaping, glyphs, lines, lineHeight, textAnchor, textJustify, spacing) : shapeLines(shaping, glyphs, lines, lineHeight, textAnchor, textJustify, spacing);
|
|
244
|
+
|
|
219
245
|
if (!positionedGlyphs.length) {
|
|
220
246
|
return false;
|
|
221
247
|
}
|
|
248
|
+
|
|
222
249
|
return shaping;
|
|
223
250
|
}
|
|
251
|
+
|
|
224
252
|
function getGlyphQuads(shaping) {
|
|
225
253
|
var textOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0];
|
|
226
254
|
var alongLine = arguments.length > 2 ? arguments[2] : undefined;
|
|
227
255
|
var _shaping$positionedGl = shaping.positionedGlyphs,
|
|
228
|
-
|
|
256
|
+
positionedGlyphs = _shaping$positionedGl === void 0 ? [] : _shaping$positionedGl;
|
|
229
257
|
var quads = [];
|
|
258
|
+
|
|
230
259
|
var _iterator2 = _createForOfIteratorHelper(positionedGlyphs),
|
|
231
|
-
|
|
260
|
+
_step2;
|
|
261
|
+
|
|
232
262
|
try {
|
|
233
263
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
234
264
|
var positionedGlyph = _step2.value;
|
|
235
|
-
var rect = positionedGlyph.metrics;
|
|
265
|
+
var rect = positionedGlyph.metrics; // The rects have an addditional buffer that is not included in their size.
|
|
236
266
|
|
|
237
|
-
// The rects have an addditional buffer that is not included in their size.
|
|
238
267
|
var rectBuffer = 4;
|
|
239
268
|
var halfAdvance = rect.advance * positionedGlyph.scale / 2;
|
|
240
269
|
var glyphOffset = alongLine ? [positionedGlyph.x + halfAdvance, positionedGlyph.y] : [0, 0];
|
|
@@ -258,9 +287,7 @@ function getGlyphQuads(shaping) {
|
|
|
258
287
|
var br = {
|
|
259
288
|
x: x2,
|
|
260
289
|
y: y2
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
// TODO:处理字符旋转的情况
|
|
290
|
+
}; // TODO:处理字符旋转的情况
|
|
264
291
|
|
|
265
292
|
quads.push({
|
|
266
293
|
tl: tl,
|
|
@@ -276,5 +303,6 @@ function getGlyphQuads(shaping) {
|
|
|
276
303
|
} finally {
|
|
277
304
|
_iterator2.f();
|
|
278
305
|
}
|
|
306
|
+
|
|
279
307
|
return quads;
|
|
280
308
|
}
|