@maptalks/transform-control 0.99.0 → 0.101.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.
@@ -1,17 +1,17 @@
1
1
  /*!
2
- * @maptalks/transform-control v0.99.0
2
+ * @maptalks/transform-control v0.101.0
3
3
  * LICENSE : UNLICENSED
4
4
  * (c) 2016-2024 maptalks.org
5
5
  */
6
- import { quat as A, mat4 as e, reshader as t, vec3 as s, vec2 as i, GroupGLLayer as n } from "@maptalks/gl";
6
+ import { quat as A, mat4 as e, reshader as t, vec3 as s, gltf as i, vec2 as n } from "@maptalks/gl";
7
7
 
8
8
  import * as I from "maptalks";
9
9
 
10
- import { Point as o, Coordinate as g, Eventable as r, Handlerable as C, Class as a } from "maptalks";
10
+ import { Point as o, Coordinate as g, Eventable as r, Handlerable as a, Class as C, INTERNAL_LAYER_PREFIX as h } from "maptalks";
11
11
 
12
- import * as h from "@maptalks/gltf-loader";
12
+ import { GLTFLayer as w, GLTFMarker as c } from "@maptalks/gltf-layer";
13
13
 
14
- const w = {
14
+ const Q = {
15
15
  yuanhuan: {
16
16
  accessors: [ {
17
17
  name: "����С��_1_0_positions",
@@ -1156,33 +1156,33 @@ const w = {
1156
1156
  }
1157
1157
  };
1158
1158
 
1159
- function c(s, i, n, I, o, g) {
1160
- const r = [], C = A.fromEuler([], n[0], n[1], n[2]), a = e.fromRotationTranslationScale([], C, i, I), c = function(A) {
1161
- return new h.GLTFLoader("", JSON.parse(JSON.stringify(w[A]))).load().then((A => A));
1159
+ function f(s, n, I, o, g, r) {
1160
+ const a = [], C = A.fromEuler([], I[0], I[1], I[2]), h = e.fromRotationTranslationScale([], C, n, o), w = function(A) {
1161
+ return new i.GLTFLoader("", JSON.parse(JSON.stringify(Q[A]))).load().then((A => A));
1162
1162
  }(s);
1163
- return c.then((A => {
1163
+ return w.then((A => {
1164
1164
  t.GLTFHelper.exportGLTFPack(A).getMeshesInfo().forEach(((A, s) => {
1165
- const C = new t.Material({
1166
- color: o || A.materialInfo.baseColorFactor
1167
- }), h = new t.Mesh(A.geometry, C);
1168
- h.setUniform("uPickingId", g + s);
1169
- const w = h.getDefines();
1170
- w.HAS_PICKING_ID = 2, h.setDefines(w), h.translate = i, h.rotation = n, h.scaling = I,
1171
- e.multiply(h.localTransform, a, A.nodeMatrix), h.originTransform = e.copy([], h.localTransform),
1172
- h.originColor = o || A.materialInfo.baseColorFactor, r.push(h);
1173
- })), g > 100 && (r[0].properties.relatedMeshes = r.slice(1, 2), r[1].properties.relatedMeshes = r.slice(0, 1),
1174
- r[2].properties.relatedMeshes = r.slice(3, 4), r[3].properties.relatedMeshes = r.slice(2, 3),
1175
- r[4].properties.relatedMeshes = r.slice(5, 6), r[5].properties.relatedMeshes = r.slice(4, 5),
1176
- r[6].properties.relatedMeshes = r.slice(0, 6));
1177
- })), r;
1165
+ const i = new t.Material({
1166
+ color: g || A.materialInfo.baseColorFactor
1167
+ }), C = new t.Mesh(A.geometry, i);
1168
+ C.setUniform("uPickingId", r + s);
1169
+ const w = C.getDefines();
1170
+ w.HAS_PICKING_ID = 2, C.setDefines(w), C.translate = n, C.rotation = I, C.scaling = o,
1171
+ e.multiply(C.localTransform, h, A.nodeMatrix), C.originTransform = e.copy([], C.localTransform),
1172
+ C.originColor = g || A.materialInfo.baseColorFactor, a.push(C);
1173
+ })), r > 100 && (a[0].properties.relatedMeshes = a.slice(1, 2), a[1].properties.relatedMeshes = a.slice(0, 1),
1174
+ a[2].properties.relatedMeshes = a.slice(3, 4), a[3].properties.relatedMeshes = a.slice(2, 3),
1175
+ a[4].properties.relatedMeshes = a.slice(5, 6), a[5].properties.relatedMeshes = a.slice(4, 5),
1176
+ a[6].properties.relatedMeshes = a.slice(0, 6));
1177
+ })), a;
1178
1178
  }
1179
1179
 
1180
- function Q(A, e) {
1180
+ function l(A, e) {
1181
1181
  return Math.abs(A) * Math.sign(e);
1182
1182
  }
1183
1183
 
1184
- function f(A, e) {
1185
- const t = A.getCoordinates(), i = e.coordinateToPointAtRes(t, e.getGLRes()), n = [ i.x, i.y, 0 ], o = l(e, A.getTranslation());
1184
+ function P(A, e) {
1185
+ const t = A.getCoordinates(), i = e.coordinateToPointAtRes(t, e.getGLRes()), n = [ i.x, i.y, 0 ], o = D(e, A.getTranslation());
1186
1186
  s.add(n, n, o);
1187
1187
  const g = function(A, e, t, s) {
1188
1188
  return A._pointAtResToContainerPoint(e, t, s);
@@ -1197,13 +1197,13 @@ function f(A, e) {
1197
1197
  return Math.sqrt(Math.pow(r.x - n[0], 2) + Math.pow(r.y - n[1], 2)) / 5.272881136101205;
1198
1198
  }
1199
1199
 
1200
- function l(A, e) {
1200
+ function D(A, e) {
1201
1201
  if (!A) return e;
1202
1202
  const t = A.distanceToPointAtRes(e[0], e[1], A.getGLRes()), i = A.altitudeToPoint(e[2], A.getGLRes());
1203
- return s.set([], Q(t.x, e[0]), Q(t.y, e[1]), Q(i, e[2]));
1203
+ return s.set([], l(t.x, e[0]), l(t.y, e[1]), l(i, e[2]));
1204
1204
  }
1205
1205
 
1206
- class P {
1206
+ class u {
1207
1207
  constructor(A) {
1208
1208
  this.A = A, this._meshes = this.t();
1209
1209
  }
@@ -1211,7 +1211,7 @@ class P {
1211
1211
  this.A = A;
1212
1212
  }
1213
1213
  t() {
1214
- const A = [], e = 340 / 177, t = c("jiantou", [ 1.2 * e, 0, 0 ], [ 0, 0, 90 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 7), s = c("jiantou", [ 0, 1.2 * e, 0 ], [ 0, 0, 180 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 8), i = c("jiantou", [ -1.2 * e, 0, 0 ], [ 0, 0, 270 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 9), n = c("jiantou", [ 0, -1.2 * e, 0 ], [ 0, 0, 0 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 10);
1214
+ const A = [], e = 340 / 177, t = f("jiantou", [ 1.2 * e, 0, 0 ], [ 0, 0, 90 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 7), s = f("jiantou", [ 0, 1.2 * e, 0 ], [ 0, 0, 180 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 8), i = f("jiantou", [ -1.2 * e, 0, 0 ], [ 0, 0, 270 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 9), n = f("jiantou", [ 0, -1.2 * e, 0 ], [ 0, 0, 0 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 10);
1215
1215
  return A.push(t, s, i, n), A;
1216
1216
  }
1217
1217
  getMeshes() {
@@ -1219,7 +1219,7 @@ class P {
1219
1219
  }
1220
1220
  }
1221
1221
 
1222
- class D {
1222
+ class m {
1223
1223
  constructor(A) {
1224
1224
  this.A = A, this._meshes = this.t();
1225
1225
  }
@@ -1227,7 +1227,7 @@ class D {
1227
1227
  this.A = A;
1228
1228
  }
1229
1229
  t() {
1230
- const A = [], e = 340 / 177, t = c("xuanzhuan", [ 0, 0, 0 ], [ 180, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 50 / 255, 130 / 255, 184 / 255, .8 ], 11);
1230
+ const A = [], e = 340 / 177, t = f("xuanzhuan", [ 0, 0, 0 ], [ 180, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 50 / 255, 130 / 255, 184 / 255, .8 ], 11);
1231
1231
  return A.push(t), A;
1232
1232
  }
1233
1233
  getMeshes() {
@@ -1235,7 +1235,7 @@ class D {
1235
1235
  }
1236
1236
  }
1237
1237
 
1238
- class u {
1238
+ class b {
1239
1239
  constructor(A) {
1240
1240
  this.A = A, this._meshes = this.t();
1241
1241
  }
@@ -1243,7 +1243,7 @@ class u {
1243
1243
  this.A = A;
1244
1244
  }
1245
1245
  t() {
1246
- const A = [], e = 340 / 177, t = c("yuanhuan", [ 0, 0, 0 ], [ 0, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 149 / 255, 179 / 255, 199 / 255, .5 ], 12);
1246
+ const A = [], e = 340 / 177, t = f("yuanhuan", [ 0, 0, 0 ], [ 0, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 149 / 255, 179 / 255, 199 / 255, .5 ], 12);
1247
1247
  return A.push(t), A;
1248
1248
  }
1249
1249
  getMeshes() {
@@ -1251,7 +1251,7 @@ class u {
1251
1251
  }
1252
1252
  }
1253
1253
 
1254
- class m {
1254
+ class B {
1255
1255
  constructor(A) {
1256
1256
  this.A = A, this._meshes = this.t();
1257
1257
  }
@@ -1259,7 +1259,7 @@ class m {
1259
1259
  this.A = A;
1260
1260
  }
1261
1261
  t() {
1262
- const A = [], e = c("plane", [ 0, 0, 0 ], [ 0, 0, 0 ], [ 10, 10, 10 ], [ 1, 0, 0, .5 ], 16);
1262
+ const A = [], e = f("plane", [ 0, 0, 0 ], [ 0, 0, 0 ], [ 10, 10, 10 ], [ 1, 0, 0, .5 ], 16);
1263
1263
  return A.push(e), A;
1264
1264
  }
1265
1265
  getMeshes() {
@@ -1267,7 +1267,7 @@ class m {
1267
1267
  }
1268
1268
  }
1269
1269
 
1270
- class b {
1270
+ class y {
1271
1271
  constructor(A) {
1272
1272
  this.A = A, this._meshes = this.t();
1273
1273
  }
@@ -1275,7 +1275,7 @@ class b {
1275
1275
  this.A = A;
1276
1276
  }
1277
1277
  t() {
1278
- const A = [], e = c("xyzScale", [ 0, 0, 0 ], [ 0, 0, 0 ], [ 2, 2, 2 ], null, 113);
1278
+ const A = [], e = f("xyzScale", [ 0, 0, 0 ], [ 0, 0, 0 ], [ 2, 2, 2 ], null, 113);
1279
1279
  return A.push(e), A;
1280
1280
  }
1281
1281
  getMeshes() {
@@ -1283,48 +1283,48 @@ class b {
1283
1283
  }
1284
1284
  }
1285
1285
 
1286
- const B = [], y = [], p = [], v = [], L = [], M = [ 177 / 170, 177 / 170, 177 / 170 ], d = [], E = [ 1, 2, 3, 4, 12 ];
1286
+ const p = [], v = [], L = [], d = [], M = [], E = [ 177 / 170, 177 / 170, 177 / 170 ], O = [], F = [ 1, 2, 3, 4, 12 ];
1287
1287
 
1288
- class O {
1288
+ class x {
1289
1289
  constructor() {
1290
- this.translate = new P, this.rotation = new D, this.scaling = new u, this.planeHelper = new m,
1291
- this.xyzScaleHelper = new b, this._meshes = this.t(), this.i = !0;
1290
+ this.translate = new u, this.rotation = new m, this.scaling = new b, this.planeHelper = new B,
1291
+ this.xyzScaleHelper = new y, this._meshes = this.t(), this.i = !0;
1292
1292
  }
1293
1293
  t() {
1294
1294
  const A = {};
1295
1295
  A.translate = this.translate.getMeshes(), A.rotation = this.rotation.getMeshes(),
1296
1296
  A.scaling = this.scaling.getMeshes(), A.planeHelper = this.planeHelper.getMeshes(),
1297
1297
  A.xyzScale = this.xyzScaleHelper.getMeshes();
1298
- const e = 340 / 177, t = c("yuanhuan41", [ -2.745 * e, 2.745 * e, 0 ], [ 90, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 149 / 255, 179 / 255, 199 / 255, .6 ], 1), s = c("yuanhuan41", [ 2.745 * e, 2.745 * e, 0 ], [ -90, 0, 180 ], [ .5 * e, .5 * e, .5 * e ], [ 50 / 255, 130 / 255, 184 / 255, .5 ], 2), i = c("yuanhuan41", [ 2.745 * e, -2.745 * e, 0 ], [ 90, 0, 180 ], [ .5 * e, .5 * e, .5 * e ], [ 149 / 255, 179 / 255, 199 / 255, .6 ], 3), n = c("yuanhuan41", [ -2.745 * e, -2.745 * e, 0 ], [ -90, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 50 / 255, 130 / 255, 184 / 255, .5 ], 4), I = c("yuanpan", [ 0, 0, 0 ], [ 90, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 89 / 255, 206 / 255, 147 / 255, .5 ], 5), o = c("zzhou", [ 0, 0, 6.5 ], [ 90, 0, 0 ], [ 1, 1, 1 ], [ 14 / 255, 127 / 255, 191 / 255, 1 ], 6);
1298
+ const e = 340 / 177, t = f("yuanhuan41", [ -2.745 * e, 2.745 * e, 0 ], [ 90, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 149 / 255, 179 / 255, 199 / 255, .6 ], 1), s = f("yuanhuan41", [ 2.745 * e, 2.745 * e, 0 ], [ -90, 0, 180 ], [ .5 * e, .5 * e, .5 * e ], [ 50 / 255, 130 / 255, 184 / 255, .5 ], 2), i = f("yuanhuan41", [ 2.745 * e, -2.745 * e, 0 ], [ 90, 0, 180 ], [ .5 * e, .5 * e, .5 * e ], [ 149 / 255, 179 / 255, 199 / 255, .6 ], 3), n = f("yuanhuan41", [ -2.745 * e, -2.745 * e, 0 ], [ -90, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 50 / 255, 130 / 255, 184 / 255, .5 ], 4), I = f("yuanpan", [ 0, 0, 0 ], [ 90, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 89 / 255, 206 / 255, 147 / 255, .5 ], 5), o = f("zzhou", [ 0, 0, 6.5 ], [ 90, 0, 0 ], [ 1, 1, 1 ], [ 14 / 255, 127 / 255, 191 / 255, 1 ], 6);
1299
1299
  return A.translate.push(t, s, i, n, I, o), A;
1300
1300
  }
1301
1301
  updateMatrix(t, i, n, I, o) {
1302
- const g = i.getCoordinates(), r = t.coordinateToPointAtRes(g, t.getGLRes()), C = i.I();
1303
- s.set(y, r.x, r.y, C);
1304
- const a = s.copy(B, o), h = l(t, i.getTranslation());
1305
- s.add(y, y, h), s.add(y, y, a);
1302
+ const g = i.getCoordinates(), r = t.coordinateToPointAtRes(g, t.getGLRes()), a = i.I();
1303
+ s.set(v, r.x, r.y, a);
1304
+ const C = s.copy(p, o), h = D(t, i.getTranslation());
1305
+ s.add(v, v, h), s.add(v, v, C);
1306
1306
  for (const o in this._meshes) for (let g = 0; g < this._meshes[o].length; g++) {
1307
1307
  const r = this._meshes[o][g];
1308
1308
  for (let g = 0; g < r.length; g++) {
1309
- const C = r[g], a = C.getUniform("uPickingId"), h = s.copy(B, C.translate);
1310
- let w = s.copy(d, C.rotation);
1311
- const c = C.scaling;
1312
- if (11 === a && (this.i ? (w[2] += n, C.rotation[2] += n) : this.i || (w[2] += n,
1313
- C.rotation[2] += n, w[0] = 360, w[2] -= 90)), a > 100 && 1 === i.getTargets().length && (w = i.getTargets()[0].getRotation()),
1314
- E.indexOf(a) > -1) if (12 !== a) c[0] += I, c[1] += I, c[2] += I; else {
1309
+ const a = r[g], C = a.getUniform("uPickingId"), h = s.copy(p, a.translate);
1310
+ let w = s.copy(O, a.rotation);
1311
+ const c = a.scaling;
1312
+ if (11 === C && (this.i ? (w[2] += n, a.rotation[2] += n) : this.i || (w[2] += n,
1313
+ a.rotation[2] += n, w[0] = 360, w[2] -= 90)), C > 100 && 1 === i.getTargets().length && (w = i.getTargets()[0].getRotation()),
1314
+ F.indexOf(C) > -1) if (12 !== C) c[0] += I, c[1] += I, c[2] += I; else {
1315
1315
  const A = this._meshes.translate[4][0];
1316
1316
  c[0] = 1.2 * A.scaling[0], c[1] = 1.2 * A.scaling[0], c[2] = 1.2 * A.scaling[0];
1317
1317
  }
1318
- let Q = f(i, t);
1319
- if (Q = s.set(p, Q, Q, Q), s.multiply(h, h, Q), s.multiply(Q, Q, c), 1 === a || 2 === a || 3 === a || 4 === a) {
1320
- const A = s.multiply(L, c, M);
1318
+ let Q = P(i, t);
1319
+ if (Q = s.set(L, Q, Q, Q), s.multiply(h, h, Q), s.multiply(Q, Q, c), 1 === C || 2 === C || 3 === C || 4 === C) {
1320
+ const A = s.multiply(M, c, E);
1321
1321
  s.multiply(h, h, A);
1322
1322
  }
1323
- const l = A.fromEuler(v, w[0], w[1], w[2]);
1324
- if (s.add(h, h, y), "xyzScale" === o) {
1325
- const A = e.fromRotationTranslationScale([], l, h, Q);
1326
- e.multiply(C.localTransform, A, C.originTransform);
1327
- } else e.fromRotationTranslationScale(C.localTransform, l, h, Q);
1323
+ const f = A.fromEuler(d, w[0], w[1], w[2]);
1324
+ if (s.add(h, h, v), "xyzScale" === o) {
1325
+ const A = e.fromRotationTranslationScale([], f, h, Q);
1326
+ e.multiply(a.localTransform, A, a.originTransform);
1327
+ } else e.fromRotationTranslationScale(a.localTransform, f, h, Q);
1328
1328
  }
1329
1329
  }
1330
1330
  }
@@ -1347,9 +1347,9 @@ class O {
1347
1347
  }
1348
1348
  }
1349
1349
 
1350
- const F = [], x = [], U = [], V = new o(0, 0), S = [], k = [], T = [], H = [ 0, 0, 0 ];
1350
+ const U = [], V = [], S = [], k = new o(0, 0), T = [], H = [], J = [], N = [ 0, 0, 0 ];
1351
1351
 
1352
- class J {
1352
+ class R {
1353
1353
  constructor() {
1354
1354
  this.C = [], this.h = [ 0, 0, 0 ], this.l = [ 1, 1, 1 ], this.P = [ 0, 0, 0 ];
1355
1355
  }
@@ -1370,20 +1370,20 @@ class J {
1370
1370
  }
1371
1371
  p(A, e, t, i, n, I, o) {
1372
1372
  for (let o = 0; o < this.C.length; o++) {
1373
- const g = this.C[o], r = g.getRotation(), C = g.getScale(), a = this.v(I, g, i, t, e);
1373
+ const g = this.C[o], r = g.getRotation(), a = g.getScale(), C = this.v(I, g, i, t, e);
1374
1374
  let h = null;
1375
1375
  h = i >= 0 ? i : i * (this.options && this.options.scaleStrength || 1);
1376
- const w = s.add(T, s.set(F, h * C[0], h * C[1], h * C[2]), C), c = Math.min(...w);
1376
+ const w = s.add(J, s.set(U, h * a[0], h * a[1], h * a[2]), a), c = Math.min(...w);
1377
1377
  if (Math.abs(c) < n) {
1378
1378
  const A = Math.abs(c);
1379
1379
  w[0] = w[0] * (n / A), w[1] = w[1] * (n / A), w[2] = w[2] * (n / A);
1380
1380
  }
1381
1381
  const Q = s.add(r, t, r);
1382
- g.setCoordinates(a), this.L(A, w, C);
1382
+ g.setCoordinates(C), this.L(A, w, a);
1383
1383
  const f = g.getTranslation();
1384
1384
  g.setTRS(f, Q, w);
1385
1385
  }
1386
- s.set(T, i, i, i), s.add(this.P, t, this.P), s.add(this.l, T, this.l), s.add(this.h, e, this.h),
1386
+ s.set(J, i, i, i), s.add(this.P, t, this.P), s.add(this.l, J, this.l), s.add(this.h, e, this.h),
1387
1387
  A.indexOf("translate") > -1 ? o.fire("positionchange", {
1388
1388
  action: A,
1389
1389
  type: "positionchange",
@@ -1409,16 +1409,16 @@ class J {
1409
1409
  });
1410
1410
  }
1411
1411
  v(t, i, n, I, o) {
1412
- const g = i.getCenter(), r = i.getTransformOrigin(), C = t.getGLRes(), a = t.coordinateToPointAtRes(g, C, V);
1413
- a.z = t.altitudeToPoint(g.z, C), s.set(S, a.x, a.y, a.z || 0);
1414
- const h = t.coordinateToPointAtRes(r, C, V);
1415
- h.z = t.altitudeToPoint(r.z, C), s.set(k, h.x, h.y, h.z || 0);
1416
- const w = s.sub(F, S, k), c = A.fromEuler(x, 0, 0, I[2]);
1417
- s.set(T, n + 1, n + 1, n + 1);
1418
- const Q = e.fromRotationTranslationScale(U, c, o, T);
1419
- s.transformMat4(w, w, Q), s.add(w, w, k), V.set(w[0], w[1]);
1420
- const f = t.pointAtResToCoordinate(V, C);
1421
- return f.z = w[2] / t.altitudeToPoint(1, C), f;
1412
+ const g = i.getCenter(), r = i.getTransformOrigin(), a = t.getGLRes(), C = t.coordinateToPointAtRes(g, a, k);
1413
+ C.z = t.altitudeToPoint(g.z, a), s.set(T, C.x, C.y, C.z || 0);
1414
+ const h = t.coordinateToPointAtRes(r, a, k);
1415
+ h.z = t.altitudeToPoint(r.z, a), s.set(H, h.x, h.y, h.z || 0);
1416
+ const w = s.sub(U, T, H), c = A.fromEuler(V, 0, 0, I[2]);
1417
+ s.set(J, n + 1, n + 1, n + 1);
1418
+ const Q = e.fromRotationTranslationScale(S, c, o, J);
1419
+ s.transformMat4(w, w, Q), s.add(w, w, H), k.set(w[0], w[1]);
1420
+ const f = t.pointAtResToCoordinate(k, a);
1421
+ return f.z = w[2] / t.altitudeToPoint(1, a), f;
1422
1422
  }
1423
1423
  L(A, e, t) {
1424
1424
  return "x-scale" === A && (e[1] = t[1], e[2] = t[2]), "y-scale" === A && (e[0] = t[0],
@@ -1436,7 +1436,7 @@ class J {
1436
1436
  return this.l;
1437
1437
  }
1438
1438
  getTranslation() {
1439
- return 1 === this.C.length && this.C[0].getTranslation() || H;
1439
+ return 1 === this.C.length && this.C[0].getTranslation() || N;
1440
1440
  }
1441
1441
  getRotation() {
1442
1442
  return this.P;
@@ -1478,13 +1478,16 @@ class J {
1478
1478
  }
1479
1479
  }
1480
1480
 
1481
- const N = [ 5, 6, 7, 8, 9, 10 ], R = [ 5, 7, 8, 9, 10 ], _ = [ 2, 4, 11 ], K = [ 1, 3, 12 ], z = [ 12, 16 ], G = [ 1, 2, 3, 4 ], j = [ 1, 2, 3, 4, 12 ], Z = [], Y = [], W = [], q = [], X = [], $ = [], AA = [];
1481
+ const _ = [ 5, 6, 7, 8, 9, 10 ], K = [ 5, 7, 8, 9, 10 ], z = [ 2, 4, 11 ], G = [ 1, 3, 12 ], j = [ 12, 16 ], Z = [ 1, 2, 3, 4 ], Y = [ 1, 2, 3, 4, 12 ], W = [], q = [], X = [], $ = [], AA = [], eA = [], tA = [];
1482
1482
 
1483
- class eA extends(r(C(a))){
1483
+ class sA extends(r(a(C))){
1484
1484
  constructor(A = {}) {
1485
1485
  super(A), this.options = A, this.mouseAction = "moving", this.U = this.options.mode || "translate",
1486
- this.V = !0, this.TransformHelper = new O, this.S = new J, this.helperScene = new t.Scene([]),
1487
- this.addToMapCount = 0;
1486
+ this.V = !0, this.TransformHelper = new x, this.S = new R, this.helperScene = new t.Scene([]),
1487
+ this.addToMapCount = 0, this.k();
1488
+ }
1489
+ setCoordinates(A) {
1490
+ this.T.setCoordinates(A), this.transform(this.T);
1488
1491
  }
1489
1492
  enable() {
1490
1493
  return this.V = !0, this.layerRenderer && this.layerRenderer.setToRedraw(), this;
@@ -1494,7 +1497,7 @@ class eA extends(r(C(a))){
1494
1497
  this;
1495
1498
  }
1496
1499
  setMode(A) {
1497
- this.U = A, this.k(), this.layerRenderer && this.layerRenderer.setToRedraw(), this.fire("modechange", {
1500
+ this.U = A, this.H(), this.layerRenderer && this.layerRenderer.setToRedraw(), this.fire("modechange", {
1498
1501
  mode: A,
1499
1502
  type: "modechange"
1500
1503
  });
@@ -1505,222 +1508,234 @@ class eA extends(r(C(a))){
1505
1508
  isEnable() {
1506
1509
  return this.V;
1507
1510
  }
1508
- T(A) {
1509
- N.indexOf(A) > -1 ? this.U = "translate" : _.indexOf(A) > -1 ? this.U = "rotation" : K.indexOf(A) > -1 ? this.U = "scaling" : "xyzScale" !== this.U && (this.U = "translate");
1511
+ J(A) {
1512
+ _.indexOf(A) > -1 ? this.U = "translate" : z.indexOf(A) > -1 ? this.U = "rotation" : G.indexOf(A) > -1 ? this.U = "scaling" : "xyzScale" !== this.U && (this.U = "translate");
1510
1513
  }
1511
- H() {
1514
+ N() {
1512
1515
  return this.U;
1513
1516
  }
1514
1517
  addTo(A) {
1515
- this.map && (this.J(), console.warn("transform control has been added to a map, it suggest remove from the map before")),
1516
- this.addToMapCount++, this.map = A, this.container = A.getContainer(), A.on("dom:mousemove", this.N, this),
1517
- A.on("dom:mousedown", this.R, this), A.on("dom:mouseup", this._, this), A.on("zooming moving dragrotating", this.K, this),
1518
- this.G();
1518
+ if (this.map) return this.R(), void console.warn("transform control has been added to a map, it suggest remove from the map before");
1519
+ this.addToMapCount++, this.map = A, this._.addTo(this.map), this.container = A.getContainer(),
1520
+ A.on("dom:mousemove", this.K, this), A.on("dom:mousedown", this.G, this), A.on("dom:mouseup", this.j, this),
1521
+ A.on("zooming moving dragrotating", this.Z, this), this.Y();
1519
1522
  }
1520
- remove() {
1521
- this.map && this.container && this.layerRenderer && (this.J(), this.TransformHelper.dispose(),
1522
- this.layerRenderer.setToRedraw(), delete this.map, delete this.layer, delete this.layerRenderer,
1523
- delete this.container, delete this.S);
1523
+ k() {
1524
+ this._ = new w(`${h}_transformcontrol`), this.T = new c([ 0, 0 ], {
1525
+ symbol: {
1526
+ url: "cube",
1527
+ modelHeight: 1,
1528
+ uniforms: {
1529
+ polygonOpacity: .01
1530
+ }
1531
+ }
1532
+ }).addTo(this._);
1524
1533
  }
1525
- J() {
1526
- this.container && this.map && (this.map.off("dom:mousemove", this.N, this), this.map.off("dom:mousedown", this.R, this),
1527
- this.map.off("dom:mouseup", this._, this), this.map.off("zooming moving dragrotating", this.K, this),
1534
+ remove() {
1535
+ this.map && this.container && this.layerRenderer && (this.R(), this.TransformHelper.dispose(),
1536
+ this.layerRenderer.setToRedraw(), this._.remove(), delete this.T, delete this._,
1537
+ delete this.map, delete this.layer, delete this.layerRenderer, delete this.container,
1538
+ delete this.S);
1539
+ }
1540
+ R() {
1541
+ this.container && this.map && (this.map.off("dom:mousemove", this.K, this), this.map.off("dom:mousedown", this.G, this),
1542
+ this.map.off("dom:mouseup", this.j, this), this.map.off("zooming moving dragrotating", this.Z, this),
1528
1543
  this.layer && this.layer.off("renderend", this.render, this));
1529
1544
  }
1530
- N(A) {
1531
- if (this.j()) {
1545
+ K(A) {
1546
+ if (this.W()) {
1532
1547
  if (this.currentMousePosition = {
1533
1548
  x: A.containerPoint.x,
1534
1549
  y: A.containerPoint.y
1535
1550
  }, "moving" === this.mouseAction) {
1536
- const A = this.Z();
1537
- this.currentPickingObject = this.Y(this.currentMousePosition, A, "meshes"), this.currentPickingObject && null != this.currentPickingObject.pickingId ? (this.T(this.currentPickingObject.pickingId),
1538
- 6 === this.currentPickingObject.pickingId ? this.W(!0) : this.W(!1)) : (this.W(!1),
1539
- this.T()), this.q();
1551
+ const A = this.q();
1552
+ this.currentPickingObject = this.X(this.currentMousePosition, A, "meshes"), this.currentPickingObject && null != this.currentPickingObject.pickingId ? (this.J(this.currentPickingObject.pickingId),
1553
+ 6 === this.currentPickingObject.pickingId ? this.$(!0) : this.$(!1)) : (this.$(!1),
1554
+ this.J()), this.AA();
1540
1555
  }
1541
- this.X(this.currentMousePosition);
1556
+ this.eA(this.currentMousePosition);
1542
1557
  }
1543
1558
  }
1544
- R(A) {
1545
- if (!this.j() || 0 !== A.domEvent.button) return;
1546
- const e = this.Z();
1559
+ G(A) {
1560
+ if (!this.W() || 0 !== A.domEvent.button) return;
1561
+ const e = this.q();
1547
1562
  this.currentMousePosition = {
1548
1563
  x: A.containerPoint.x,
1549
1564
  y: A.containerPoint.y
1550
- }, this.$ = !0, this.currentPickingObject = this.Y(this.currentMousePosition, e, "meshes"),
1551
- this.firstDownPoint = this.Y(this.currentMousePosition, e, "meshes"), this.currentPickingObject && null != this.currentPickingObject.meshId ? (this.mouseAction = "transform",
1552
- this.AA(this.currentPickingObject.pickingId), this.map.config("zoomable", !1), this.map.config("draggable", !1),
1565
+ }, this.tA = !0, this.currentPickingObject = this.X(this.currentMousePosition, e, "meshes"),
1566
+ this.firstDownPoint = this.X(this.currentMousePosition, e, "meshes"), this.currentPickingObject && null != this.currentPickingObject.meshId ? (this.mouseAction = "transform",
1567
+ this.sA(this.currentPickingObject.pickingId), this.map.config("zoomable", !1), this.map.config("draggable", !1),
1553
1568
  this.layerRenderer && this.layerRenderer.setToRedraw()) : (this.mouseAction = "pan",
1554
- this.map.config("zoomable", !0), this.map.config("draggable", !0), this.k()), this.lastMousePosition = this.currentMousePosition,
1569
+ this.map.config("zoomable", !0), this.map.config("draggable", !0), this.H()), this.lastMousePosition = this.currentMousePosition,
1555
1570
  this.lastPickingObject = this.currentPickingObject, this.lastPickingMesh = e[this.currentPickingObject.meshId];
1556
1571
  }
1557
- _() {
1558
- "transform" === this.mouseAction && (this.firstDownPoint = null, this.k(), this.$ = !0,
1572
+ j() {
1573
+ "transform" === this.mouseAction && (this.firstDownPoint = null, this.H(), this.tA = !0,
1559
1574
  this.fire("transformend", {
1560
- action: this.eA,
1575
+ action: this.iA,
1561
1576
  type: "transformend"
1562
1577
  })), this.mouseAction = "moving", "xyzScale" !== this.U && (this.U = "translate"),
1563
1578
  this.map.config("zoomable", !0), this.map.config("draggable", !0), this.layerRenderer && this.layerRenderer.setToRedraw();
1564
1579
  }
1565
- K() {
1580
+ Z() {
1566
1581
  const A = this.TransformHelper.planeHelper.getMeshes()[0][0], e = this.map.getBearing();
1567
- A.rotation[2] = -e, this.tA();
1582
+ A.rotation[2] = -e, this.nA();
1568
1583
  }
1569
- tA() {
1570
- this.j() && (this.TransformHelper.updateMatrix(this.map, this.S, 0, 0, [ 0, 0, 0 ]),
1571
- this.$ = !0);
1584
+ nA() {
1585
+ this.W() && (this.TransformHelper.updateMatrix(this.map, this.S, 0, 0, [ 0, 0, 0 ]),
1586
+ this.tA = !0);
1572
1587
  }
1573
1588
  picked(A) {
1574
1589
  if (!this.layerRenderer) return !1;
1575
- const e = this.Z(), t = this.map;
1590
+ const e = this.q(), t = this.map;
1576
1591
  let s = A;
1577
1592
  A instanceof o || (s = t.coordinateToContainerPoint(new g(A)));
1578
- const i = this.Y(s, e, "picked");
1593
+ const i = this.X(s, e, "picked");
1579
1594
  return !(!i || null === i.meshId);
1580
1595
  }
1581
- k() {
1596
+ H() {
1582
1597
  const A = this.TransformHelper.getMeshes("scaling").scaling[0][0], e = 340 / 177;
1583
- A.scaling = [ .6 * e, .6 * e, .6 * e ], this.layerRenderer && (this.sA(A), this.iA());
1598
+ A.scaling = [ .6 * e, .6 * e, .6 * e ], this.layerRenderer && (this.IA(A), this.oA());
1584
1599
  }
1585
- iA() {
1600
+ oA() {
1586
1601
  this.TransformHelper._meshes.translate.forEach((A => {
1587
1602
  for (let e = 0; e < A.length; e++) {
1588
1603
  const t = A[e];
1589
- G.indexOf(t.getUniform("uPickingId")) > -1 && t.material.set("color", t.originColor);
1604
+ Z.indexOf(t.getUniform("uPickingId")) > -1 && t.material.set("color", t.originColor);
1590
1605
  }
1591
1606
  }));
1592
1607
  }
1593
- sA(t) {
1594
- const i = this.S.getCoordinates(), n = this.map.coordinateToPointAtRes(i, this.map.getGLRes()), I = [ n.x, n.y, 0 ], o = l(this.map, this.S.getTranslation());
1608
+ IA(t) {
1609
+ const i = this.S.getCoordinates(), n = this.map.coordinateToPointAtRes(i, this.map.getGLRes()), I = [ n.x, n.y, 0 ], o = D(this.map, this.S.getTranslation());
1595
1610
  s.add(I, I, o);
1596
1611
  const g = s.copy([], t.translate), r = t.scaling;
1597
- let C = f(this.S, this.map);
1598
- C = s.set([], C, C, C), s.multiply(g, g, C), s.multiply(C, C, r), s.add(g, g, I),
1599
- e.fromRotationTranslationScale(t.localTransform, [ 0, 0, 0, 1 ], g, C);
1600
- this.Z().forEach((t => {
1612
+ let a = P(this.S, this.map);
1613
+ a = s.set([], a, a, a), s.multiply(g, g, a), s.multiply(a, a, r), s.add(g, g, I),
1614
+ e.fromRotationTranslationScale(t.localTransform, [ 0, 0, 0, 1 ], g, a);
1615
+ this.q().forEach((t => {
1601
1616
  const i = t.getUniform("uPickingId");
1602
1617
  if (1 === i || 3 === i || 2 === i || 4 === i) {
1603
1618
  const i = s.copy([], t.translate), n = 170 / 177;
1604
1619
  t.scaling = [ n, n, n ];
1605
1620
  const o = t.scaling, g = t.rotation;
1606
- let r = f(this.S, this.map);
1621
+ let r = P(this.S, this.map);
1607
1622
  r = s.set([], r, r, r), s.multiply(i, i, r), s.multiply(r, r, o), s.add(i, i, I);
1608
- const C = A.fromEuler([], g[0], g[1], g[2]);
1609
- e.fromRotationTranslationScale(t.localTransform, C, i, r);
1623
+ const a = A.fromEuler([], g[0], g[1], g[2]);
1624
+ e.fromRotationTranslationScale(t.localTransform, a, i, r);
1610
1625
  }
1611
1626
  }));
1612
1627
  }
1613
- nA(A) {
1628
+ gA(A) {
1614
1629
  const e = this.map.containerPointToCoordinate(A), t = this.map.coordinateToPointAtRes(e, this.map.getGLRes());
1615
1630
  return {
1616
1631
  point: [ t.x, t.y ]
1617
1632
  };
1618
1633
  }
1619
- X(A) {
1634
+ eA(A) {
1620
1635
  if ("transform" === this.mouseAction) {
1621
- const A = this.H(), e = l(this.map, this.S.getTranslation()), t = this.S.I();
1622
- let s = null, n = null;
1623
- if (e[2] + t < .01 && "z-translate" !== this.eA) s = this.nA(this.currentMousePosition),
1624
- n = this.nA(this.lastMousePosition); else {
1636
+ const A = this.N(), e = D(this.map, this.S.getTranslation()), t = this.S.I();
1637
+ let s = null, i = null;
1638
+ if (e[2] + t < .01 && "z-translate" !== this.iA) s = this.gA(this.currentMousePosition),
1639
+ i = this.gA(this.lastMousePosition); else {
1625
1640
  const A = this.TransformHelper.planeHelper.getMeshes()[0];
1626
- if (s = this.Y(this.currentMousePosition, A, "plane"), n = this.Y(this.lastMousePosition, A, "plane"),
1627
- !s || null === s.meshId || !n || null === n.meshId) return;
1641
+ if (s = this.X(this.currentMousePosition, A, "plane"), i = this.X(this.lastMousePosition, A, "plane"),
1642
+ !s || null === s.meshId || !i || null === i.meshId) return;
1628
1643
  }
1629
1644
  const I = [ 0, 0, 0 ], g = [ 0, 0, 0 ];
1630
- let r = 0, C = 0, a = 0;
1645
+ let r = 0, a = 0, C = 0;
1631
1646
  if ("translate" === A) {
1632
- if ("xy-translate" === this.eA) {
1633
- const A = s.point[0] - n.point[0], e = s.point[1] - n.point[1];
1647
+ if ("xy-translate" === this.iA) {
1648
+ const A = s.point[0] - i.point[0], e = s.point[1] - i.point[1];
1634
1649
  I[0] = A, I[1] = e;
1635
- } else if ("x-translate" === this.eA) {
1636
- const A = s.point[0] - n.point[0];
1650
+ } else if ("x-translate" === this.iA) {
1651
+ const A = s.point[0] - i.point[0];
1637
1652
  I[0] = A;
1638
- } else if ("y-translate" === this.eA) {
1639
- const A = s.point[1] - n.point[1];
1653
+ } else if ("y-translate" === this.iA) {
1654
+ const A = s.point[1] - i.point[1];
1640
1655
  I[1] = A;
1641
- } else if ("z-translate" === this.eA) {
1656
+ } else if ("z-translate" === this.iA) {
1642
1657
  let A = 0;
1643
- if (this.IA()) {
1644
- const e = this.map.getGLRes(), t = this.map._pointAtResToContainerPoint(new o(n.point[0], n.point[1]), e), I = this.map._pointAtResToContainerPoint(new o(s.point[0], s.point[1]), e), g = i.length(i.set(q, s.point[0] - n.point[0], s.point[1] - n.point[1]));
1658
+ if (this.rA()) {
1659
+ const e = this.map.getGLRes(), t = this.map._pointAtResToContainerPoint(new o(i.point[0], i.point[1]), e), I = this.map._pointAtResToContainerPoint(new o(s.point[0], s.point[1]), e), g = n.length(n.set($, s.point[0] - i.point[0], s.point[1] - i.point[1]));
1645
1660
  A = I.y < t.y ? g : -g;
1646
- } else A = s.point[2] - n.point[2];
1661
+ } else A = s.point[2] - i.point[2];
1647
1662
  I[2] = A;
1648
1663
  }
1649
- } else if ("rotation" === A) C = this.oA(s.point, n.point), C >= 0 ? this.TransformHelper.o(!0) : this.TransformHelper.o(!1),
1650
- g[2] += C; else if ("scaling" === A || "xyzScale" === A) {
1651
- const A = this.gA(), e = i.length(i.set(q, this.firstDownPoint.point[0] - A[0], this.firstDownPoint.point[1] - A[1])), t = i.length(i.set(q, n.point[0] - A[0], n.point[1] - A[1]));
1652
- r = this.rA(s.point, n.point, A, t), a = this.rA(s.point, n.point, A, e);
1664
+ } else if ("rotation" === A) a = this.aA(s.point, i.point), a >= 0 ? this.TransformHelper.o(!0) : this.TransformHelper.o(!1),
1665
+ g[2] += a; else if ("scaling" === A || "xyzScale" === A) {
1666
+ const A = this.CA(), e = n.length(n.set($, this.firstDownPoint.point[0] - A[0], this.firstDownPoint.point[1] - A[1])), t = n.length(n.set($, i.point[0] - A[0], i.point[1] - A[1]));
1667
+ r = this.hA(s.point, i.point, A, t), C = this.hA(s.point, i.point, A, e);
1653
1668
  }
1654
- this.TransformHelper.updateMatrix(this.map, this.S, C, a, I), this.S.p(this.eA, I, g, r, .01, this.map, this);
1669
+ this.TransformHelper.updateMatrix(this.map, this.S, a, C, I), this.S.p(this.iA, I, g, r, .01, this.map, this);
1655
1670
  }
1656
1671
  this.lastMousePosition = A, this.lastPickingObject = this.currentPickingObject;
1657
- const e = this.Z();
1672
+ const e = this.q();
1658
1673
  this.lastPickingMesh = e[this.currentPickingObject.meshId];
1659
1674
  }
1660
- rA(A, e, t, s, n) {
1661
- const I = (i.length(i.set(q, A[0] - t[0], A[1] - t[1])) - i.length(i.set(q, e[0] - t[0], e[1] - t[1]))) / s;
1662
- return n ? (n[0] - .01) * I : I;
1675
+ hA(A, e, t, s, i) {
1676
+ const I = (n.length(n.set($, A[0] - t[0], A[1] - t[1])) - n.length(n.set($, e[0] - t[0], e[1] - t[1]))) / s;
1677
+ return i ? (i[0] - .01) * I : I;
1663
1678
  }
1664
- gA() {
1665
- const A = this.map, e = this.S.getCoordinates(), t = A.coordinateToPointAtRes(e, A.getGLRes()), i = s.set(X, t.x, t.y, 0), n = l(A, this.S.getTranslation());
1679
+ CA() {
1680
+ const A = this.map, e = this.S.getCoordinates(), t = A.coordinateToPointAtRes(e, A.getGLRes()), i = s.set(AA, t.x, t.y, 0), n = D(A, this.S.getTranslation());
1666
1681
  return s.add(i, i, n), i;
1667
1682
  }
1668
- W(t) {
1669
- const i = this.TransformHelper.planeHelper.getMeshes()[0][0], n = e.getTranslation(W, i.localTransform), I = e.getScaling(Y, i.localTransform);
1670
- let o = A.fromEuler(Z, 0, 0, 0);
1683
+ $(t) {
1684
+ const i = this.TransformHelper.planeHelper.getMeshes()[0][0], n = e.getTranslation(X, i.localTransform), I = e.getScaling(q, i.localTransform);
1685
+ let o = A.fromEuler(W, 0, 0, 0);
1671
1686
  const g = this.map.getBearing();
1672
- t && !this.IA() ? (o = A.fromEuler(Z, 90, 0, -g), 0 === i.rotation[0] && (this.$ = !0),
1673
- s.set(i.rotation, 90, 0, -g)) : (90 === i.rotation[0] && (this.$ = !0), s.set(i.rotation, 0, 0, -g)),
1687
+ t && !this.rA() ? (o = A.fromEuler(W, 90, 0, -g), 0 === i.rotation[0] && (this.tA = !0),
1688
+ s.set(i.rotation, 90, 0, -g)) : (90 === i.rotation[0] && (this.tA = !0), s.set(i.rotation, 0, 0, -g)),
1674
1689
  e.fromRotationTranslationScale(i.localTransform, o, n, I);
1675
1690
  }
1676
- IA() {
1691
+ rA() {
1677
1692
  if (this.map.getPitch()) return !1;
1678
1693
  const A = this.map.cameraPosition, e = this.map.coordinateToPointAtRes(this.map.getCenter(), this.map.getGLRes());
1679
1694
  s.set(e, e.x, e.y, 0);
1680
- const t = this.S.getCoordinates(), i = this.map.coordinateToPointAtRes(t, this.map.getGLRes()), n = l(this.map, this.S.getTranslation()), I = s.set(W, i.x, i.y, 0), o = s.add(I, I, n), g = s.subtract([], A, o), r = s.subtract([], A, e);
1695
+ const t = this.S.getCoordinates(), i = this.map.coordinateToPointAtRes(t, this.map.getGLRes()), n = D(this.map, this.S.getTranslation()), I = s.set(X, i.x, i.y, 0), o = s.add(I, I, n), g = s.subtract([], A, o), r = s.subtract([], A, e);
1681
1696
  return s.angle(g, r) < 1 / 180 * Math.PI;
1682
1697
  }
1683
- q() {
1684
- const A = this.Z();
1698
+ AA() {
1699
+ const A = this.q();
1685
1700
  if (this.currentPickingObject && null != this.currentPickingObject.meshId) {
1686
- this.CA(), this.lastPickingObject && null != this.lastPickingObject.meshId && this.lastPickingObject.meshId !== this.currentPickingObject.meshId && this.aA();
1701
+ this.wA(), this.lastPickingObject && null != this.lastPickingObject.meshId && this.lastPickingObject.meshId !== this.currentPickingObject.meshId && this.cA();
1687
1702
  const e = A[this.currentPickingObject.meshId];
1688
- if (e && z.indexOf(this.currentPickingObject.pickingId) < 0) if (this.currentPickingObject.pickingId > 100) this.hA(e); else {
1703
+ if (e && j.indexOf(this.currentPickingObject.pickingId) < 0) if (this.currentPickingObject.pickingId > 100) this.QA(e); else {
1689
1704
  const A = [ e.originColor[0], e.originColor[1], e.originColor[2], .8 ];
1690
- e.material.set("color", A), this.wA(e, .5);
1705
+ e.material.set("color", A), this.fA(e, .5);
1691
1706
  }
1692
1707
  this.layerRenderer.setToRedraw();
1693
1708
  } else this.lastPickingObject && null != this.lastPickingObject.meshId && (this.map.resetCursor(),
1694
- this.aA(), this.layerRenderer.setToRedraw());
1709
+ this.cA(), this.layerRenderer.setToRedraw());
1695
1710
  }
1696
- hA(A) {
1711
+ QA(A) {
1697
1712
  const e = [ 1, 179 / 255, 2 / 255, 1 ];
1698
1713
  A.material.set("color", e), A.properties.relatedMeshes && A.properties.relatedMeshes.forEach((A => {
1699
1714
  A.material.set("color", e);
1700
1715
  }));
1701
1716
  }
1702
- CA() {
1703
- 6 === this.currentPickingObject.pickingId ? this.map.setCursor("ns-resize") : R.indexOf(this.currentPickingObject.pickingId) > -1 ? this.map.setCursor("move") : this.map.setCursor("pointer");
1717
+ wA() {
1718
+ 6 === this.currentPickingObject.pickingId ? this.map.setCursor("ns-resize") : K.indexOf(this.currentPickingObject.pickingId) > -1 ? this.map.setCursor("move") : this.map.setCursor("pointer");
1704
1719
  }
1705
- aA() {
1720
+ cA() {
1706
1721
  const A = this.lastPickingMesh;
1707
1722
  if (!A) return;
1708
- const e = A.getUniform("uPickingId"), t = this.Z();
1709
- R.indexOf(e) > -1 ? t.forEach((A => {
1710
- R.indexOf(A.getUniform("uPickingId")) > -1 && A.material.set("color", A.originColor);
1711
- })) : j.indexOf(e) > -1 ? t.forEach((A => {
1723
+ const e = A.getUniform("uPickingId"), t = this.q();
1724
+ K.indexOf(e) > -1 ? t.forEach((A => {
1725
+ K.indexOf(A.getUniform("uPickingId")) > -1 && A.material.set("color", A.originColor);
1726
+ })) : Y.indexOf(e) > -1 ? t.forEach((A => {
1712
1727
  const e = A.getUniform("uPickingId");
1713
- G.indexOf(e) > -1 && A.material.set("color", A.originColor);
1728
+ Z.indexOf(e) > -1 && A.material.set("color", A.originColor);
1714
1729
  })) : 11 === e && t.forEach((A => {
1715
- G.indexOf(A.getUniform("uPickingId")) > -1 && A.material.set("color", A.originColor);
1730
+ Z.indexOf(A.getUniform("uPickingId")) > -1 && A.material.set("color", A.originColor);
1716
1731
  })), A.material.set("color", A.originColor), A.properties.relatedMeshes && A.properties.relatedMeshes.forEach((A => {
1717
1732
  A.material.set("color", A.originColor);
1718
1733
  }));
1719
1734
  }
1720
- wA(A, e) {
1721
- const t = A.getUniform("uPickingId"), s = this.Z();
1722
- R.indexOf(t) > -1 ? s.forEach((t => {
1723
- if (R.indexOf(t.getUniform("uPickingId")) > -1 && t.getUniform("uPickingId") !== A.getUniform("uPickingId")) {
1735
+ fA(A, e) {
1736
+ const t = A.getUniform("uPickingId"), s = this.q();
1737
+ K.indexOf(t) > -1 ? s.forEach((t => {
1738
+ if (K.indexOf(t.getUniform("uPickingId")) > -1 && t.getUniform("uPickingId") !== A.getUniform("uPickingId")) {
1724
1739
  const A = [ t.originColor[0], t.originColor[1], t.originColor[2], e ];
1725
1740
  t.material.set("color", A);
1726
1741
  }
@@ -1741,21 +1756,21 @@ class eA extends(r(C(a))){
1741
1756
  reset() {
1742
1757
  this.map && this.S && (this.S.M(), this.TransformHelper.updateMatrix(this.map, this.S, 0, 0, [ 0, 0, 0 ]));
1743
1758
  }
1744
- oA(A, e) {
1745
- const t = this.gA(), s = i.set($, e[0] - t[0], e[1] - t[1]), n = i.set(AA, A[0] - t[0], A[1] - t[1]), I = Math.atan2(s[1], s[0]);
1746
- return (Math.atan2(n[1], n[0]) - I) / Math.PI * 180;
1759
+ aA(A, e) {
1760
+ const t = this.CA(), s = n.set(eA, e[0] - t[0], e[1] - t[1]), i = n.set(tA, A[0] - t[0], A[1] - t[1]), I = Math.atan2(s[1], s[0]);
1761
+ return (Math.atan2(i[1], i[0]) - I) / Math.PI * 180;
1747
1762
  }
1748
- AA(A) {
1749
- return this.eA = 113 === A || 114 === A ? "x-scale" : 115 === A || 116 === A ? "z-scale" : 117 === A || 118 === A ? "y-scale" : 119 === A ? "xyz-scale" : 5 === A ? "xy-translate" : 6 === A ? "z-translate" : 7 === A || 9 === A ? "x-translate" : 8 === A || 10 === A ? "y-translate" : 11 === A ? "z-rotate" : "scale",
1750
- this.eA;
1763
+ sA(A) {
1764
+ return this.iA = 113 === A || 114 === A ? "x-scale" : 115 === A || 116 === A ? "z-scale" : 117 === A || 118 === A ? "y-scale" : 119 === A ? "xyz-scale" : 5 === A ? "xy-translate" : 6 === A ? "z-translate" : 7 === A || 9 === A ? "x-translate" : 8 === A || 10 === A ? "y-translate" : 11 === A ? "z-rotate" : "scale",
1765
+ this.iA;
1751
1766
  }
1752
1767
  transform(A) {
1753
1768
  if (!A) return;
1754
1769
  if (this.layerRenderer && this.layerRenderer.layer && (this.layerRenderer.layer.off("renderend", this.render),
1755
- this.layerRenderer.layer.off("resizeCanvas", this.cA)), !this.map) return void console.error("should add to a target first");
1770
+ this.layerRenderer.layer.off("resizeCanvas", this.lA)), !this.map) return void console.error("should add to a target first");
1756
1771
  if (this.S && (this.S.B(), this.S.D(A)), !this.S.getTargets().length) return;
1757
1772
  const e = this.map;
1758
- this.TransformHelper.updateMatrix(e, this.S, 0, 0, [ 0, 0, 0 ]), this.QA(), this.$ = !0;
1773
+ this.TransformHelper.updateMatrix(e, this.S, 0, 0, [ 0, 0, 0 ]), this.PA(), this.tA = !0;
1759
1774
  }
1760
1775
  getTransformTarget() {
1761
1776
  return this.S;
@@ -1763,51 +1778,41 @@ class eA extends(r(C(a))){
1763
1778
  u() {
1764
1779
  delete this.S;
1765
1780
  }
1766
- QA() {
1781
+ PA() {
1767
1782
  const A = this.S.O();
1768
- A && (A.off("renderend", this.render), A.off("resizeCanvas", this.cA));
1769
- const e = this.map.getLayers();
1770
- let t = null;
1771
- for (let A = 0; A < e.length; A++) if (e[A] instanceof n) {
1772
- t = e[A];
1773
- break;
1774
- }
1775
- if (!t) return;
1776
- const s = t.getLayers(), i = s.indexOf(A);
1777
- if (i < 0) return;
1778
- s.splice(i, 1), s.push(A);
1779
- const I = this.map, o = A.getRenderer();
1780
- this.layerRenderer = o, this.regl = o.regl, this.renderer = o.renderer, this.fA = this.layerRenderer.getFBORayPicking(),
1781
- this.lA = {
1782
- projViewMatrix: I.projViewMatrix,
1783
- projMatrix: I.projMatrix,
1784
- viewMatrix: I.viewMatrix,
1783
+ A && (A.off("renderend", this.render), A.off("resizeCanvas", this.lA));
1784
+ const e = this.map, t = A.getRenderer();
1785
+ this.layerRenderer = t, this.regl = t.regl, this.renderer = t.renderer, this.DA = this.layerRenderer.getFBORayPicking(),
1786
+ this.uA = {
1787
+ projViewMatrix: e.projViewMatrix,
1788
+ projMatrix: e.projMatrix,
1789
+ viewMatrix: e.viewMatrix,
1785
1790
  pointSize: 1
1786
- }, A.on("renderend", this.render, this), A.on("resizeCanvas", this.cA, this), o.setToRedraw();
1791
+ }, A.on("renderend", this.render, this), A.on("resizeCanvas", this.lA, this), t.setToRedraw();
1787
1792
  }
1788
- cA() {
1789
- this.fA.clear(), this.$ = !0;
1793
+ lA() {
1794
+ this.DA.clear(), this.tA = !0;
1790
1795
  }
1791
- Y(A, e, t) {
1796
+ X(A, e, t) {
1792
1797
  const s = this.map;
1793
- if (!(s && this.fA && this.layerRenderer && this.layerRenderer.canvas)) return null;
1794
- const i = s.getDevicePixelRatio(), n = A.x * i, I = A.y * i, o = this.lA, g = this.layerRenderer.canvas.gl && this.layerRenderer.canvas.gl.wrap;
1795
- (this.$ || g || !this.PA || this.PA !== t) && (this.fA.render(e, o, !0), this.PA = t,
1796
- this.$ = !1);
1797
- return this.fA.pick(n, I, 10, o, {
1798
+ if (!(s && this.DA && this.layerRenderer && this.layerRenderer.canvas)) return null;
1799
+ const i = s.getDevicePixelRatio(), n = A.x * i, I = A.y * i, o = this.uA, g = this.layerRenderer.canvas.gl && this.layerRenderer.canvas.gl.wrap;
1800
+ (this.tA || g || !this.mA || this.mA !== t) && (this.DA.render(e, o, !0), this.mA = t,
1801
+ this.tA = !1);
1802
+ return this.DA.pick(n, I, 10, o, {
1798
1803
  viewMatrix: this.map.viewMatrix,
1799
1804
  projMatrix: this.map.projMatrix,
1800
1805
  returnPoint: !0
1801
1806
  });
1802
1807
  }
1803
- G() {
1808
+ Y() {
1804
1809
  const A = this.map.getDevicePixelRatio(), s = {
1805
1810
  x: 0,
1806
1811
  y: 0,
1807
1812
  width: () => this.map ? this.map.width * A : 1,
1808
1813
  height: () => this.map ? this.map.height * A : 1
1809
1814
  };
1810
- this.DA = new t.MeshShader({
1815
+ this.bA = new t.MeshShader({
1811
1816
  vert: "attribute vec3 aPosition;\n\nuniform mat4 projViewModelMatrix;\n\n\n\nvoid main()\n\n{\n\n gl_Position = projViewModelMatrix * vec4(aPosition, 1.0);\n\n\n\n}\n\n",
1812
1817
  frag: "precision mediump float;\n\nuniform vec4 color;\n\n\n\nvoid main() {\n\n gl_FragColor = color;\n\n}\n\n",
1813
1818
  uniforms: [ "color", {
@@ -1838,16 +1843,16 @@ class eA extends(r(C(a))){
1838
1843
  });
1839
1844
  }
1840
1845
  render() {
1841
- if (!this.j()) return;
1842
- const A = this.Z();
1846
+ if (!this.W()) return;
1847
+ const A = this.q();
1843
1848
  this.helperScene.setMeshes(A);
1844
1849
  const e = this.layerRenderer.getFrameContext();
1845
1850
  if (e && e.renderTarget && this.layerRenderer.getFrameTimestamp() !== e.timestamp) return;
1846
- this.tA(), this.DA.filter = e && e.sceneFilter;
1851
+ this.nA(), this.bA.filter = e && e.sceneFilter;
1847
1852
  const t = e && e.renderTarget && e.renderTarget.fbo;
1848
- this.renderer.render(this.DA, this.lA, this.helperScene, t);
1853
+ this.renderer.render(this.bA, this.uA, this.helperScene, t);
1849
1854
  }
1850
- Z() {
1855
+ q() {
1851
1856
  let A = [];
1852
1857
  const e = this.TransformHelper.getMeshes(this.U);
1853
1858
  for (const t in e) {
@@ -1859,17 +1864,17 @@ class eA extends(r(C(a))){
1859
1864
  if (t) for (let e = 0; e < t.length; e++) A = A.concat(t[e]);
1860
1865
  return A;
1861
1866
  }
1862
- j() {
1867
+ W() {
1863
1868
  const A = this.layerRenderer, e = A && A.layer;
1864
1869
  return A && this.S && e && e.isVisible() && this.S.F() && this.regl && this.V;
1865
1870
  }
1866
1871
  }
1867
1872
 
1868
- eA.mergeOptions({
1873
+ sA.mergeOptions({
1869
1874
  scaleStrength: 2
1870
1875
  });
1871
1876
 
1872
- export { eA as TransformControl };
1877
+ export { sA as TransformControl };
1873
1878
 
1874
- "undefined" != typeof console && console.log("@maptalks/transform-control v0.99.0");
1879
+ "undefined" != typeof console && console.log("@maptalks/transform-control v0.101.0");
1875
1880
  //# sourceMappingURL=transform-control.es.js.map