@maptalks/transform-control 0.97.4 → 0.98.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,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/transform-control v0.
|
|
2
|
+
* @maptalks/transform-control v0.98.0
|
|
3
3
|
* LICENSE : UNLICENSED
|
|
4
4
|
* (c) 2016-2024 maptalks.org
|
|
5
5
|
*/
|
|
@@ -1154,14 +1154,14 @@ const w = {
|
|
|
1154
1154
|
uri: "data:application/octet-stream;base64,6gUAQAAAgD8AAIC/6gUAQAAAgD8AAIC/6gUAQAAAgD8AAIC/6gUAQAAAgL8AAIC/6gUAQAAAgL8AAIC/6gUAQAAAgL8AAIC/6gUAQAAAgD8AAIA/6gUAQAAAgD8AAIA/6gUAQAAAgD8AAIA/6gUAQAAAgL8AAIA/6gUAQAAAgL8AAIA/6gUAQAAAgL8AAIA/AFC9OQAAgD8AAIC/AFC9OQAAgD8AAIC/AFC9OQAAgD8AAIC/AFC9OQAAgL8AAIC/AFC9OQAAgL8AAIC/AFC9OQAAgL8AAIC/AFC9OQAAgD8AAIA/AFC9OQAAgD8AAIA/AFC9OQAAgD8AAIA/AFC9OQAAgL8AAIA/AFC9OQAAgL8AAIA/AFC9OQAAgL8AAIA/AAAAAAAAAAAAAIC/AAAAAAAAgD8AAACAAACAPwAAAAAAAACAAAAAAAAAgL8AAACAAAAAAAAAAAAAAIC/AACAPwAAAAAAAACAAAAAAAAAAAAAAIA/AAAAAAAAgD8AAACAAACAPwAAAAAAAACAAAAAAAAAgL8AAACAAAAAAAAAAAAAAIA/AACAPwAAAAAAAACAAACAvwAAAAAAAACAAAAAAAAAAAAAAIC/AAAAAAAAgD8AAACAAACAvwAAAAAAAACAAAAAAAAAgL8AAACAAAAAAAAAAAAAAIC/AACAvwAAAAAAAACAAAAAAAAAAAAAAIA/AAAAAAAAgD8AAACAAACAvwAAAAAAAACAAAAAAA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gAAgD8AAAA+AACAPgAAwD4AAAAA"
|
|
1155
1155
|
} ]
|
|
1156
1156
|
}
|
|
1157
|
-
}
|
|
1157
|
+
};
|
|
1158
1158
|
|
|
1159
|
-
function
|
|
1160
|
-
const r = [], C = A.fromEuler([], n[0], n[1], n[2]), a = e.fromRotationTranslationScale([], C, i, I)
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
t.GLTFHelper.exportGLTFPack(A).getMeshesInfo().forEach((A, s) => {
|
|
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));
|
|
1162
|
+
}(s);
|
|
1163
|
+
return c.then((A => {
|
|
1164
|
+
t.GLTFHelper.exportGLTFPack(A).getMeshesInfo().forEach(((A, s) => {
|
|
1165
1165
|
const C = new t.Material({
|
|
1166
1166
|
color: o || A.materialInfo.baseColorFactor
|
|
1167
1167
|
}), h = new t.Mesh(A.geometry, C);
|
|
@@ -1170,48 +1170,40 @@ function Q(s, i, n, I, o, g) {
|
|
|
1170
1170
|
w.HAS_PICKING_ID = 2, h.setDefines(w), h.translate = i, h.rotation = n, h.scaling = I,
|
|
1171
1171
|
e.multiply(h.localTransform, a, A.nodeMatrix), h.originTransform = e.copy([], h.localTransform),
|
|
1172
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),
|
|
1173
|
+
})), g > 100 && (r[0].properties.relatedMeshes = r.slice(1, 2), r[1].properties.relatedMeshes = r.slice(0, 1),
|
|
1174
1174
|
r[2].properties.relatedMeshes = r.slice(3, 4), r[3].properties.relatedMeshes = r.slice(2, 3),
|
|
1175
1175
|
r[4].properties.relatedMeshes = r.slice(5, 6), r[5].properties.relatedMeshes = r.slice(4, 5),
|
|
1176
1176
|
r[6].properties.relatedMeshes = r.slice(0, 6));
|
|
1177
|
-
}), r;
|
|
1177
|
+
})), r;
|
|
1178
1178
|
}
|
|
1179
1179
|
|
|
1180
|
-
function
|
|
1180
|
+
function Q(A, e) {
|
|
1181
1181
|
return Math.abs(A) * Math.sign(e);
|
|
1182
1182
|
}
|
|
1183
1183
|
|
|
1184
|
-
function
|
|
1185
|
-
const
|
|
1186
|
-
s.add(
|
|
1187
|
-
const
|
|
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());
|
|
1186
|
+
s.add(n, n, o);
|
|
1187
|
+
const g = function(A, e, t, s) {
|
|
1188
1188
|
return A._pointAtResToContainerPoint(e, t, s);
|
|
1189
|
-
}(
|
|
1190
|
-
|
|
1191
|
-
const
|
|
1192
|
-
if (n) {
|
|
1193
|
-
const o = i / A._getResolution(), g = A.width / 2, r = A.height / 2;
|
|
1194
|
-
c[0] = (t.x - g) / g, c[1] = t.y / r - 1, c[3] = n * o;
|
|
1195
|
-
const C = e.invert([], A.projViewMatrix);
|
|
1196
|
-
s.transformMat4(c, c, C);
|
|
1197
|
-
const a = A.getGLScale();
|
|
1198
|
-
return s.set(c, c[0] / a, c[1] / a, c[2] / a), s.scale(c, c, 1 / o), new I.Point(c[0], c[1]);
|
|
1199
|
-
}
|
|
1189
|
+
}(e, new I.Point(n[0], n[1]), e.getGLRes());
|
|
1190
|
+
g.x += 85;
|
|
1191
|
+
const r = function(A, e, t, s) {
|
|
1200
1192
|
{
|
|
1201
|
-
const
|
|
1202
|
-
return A.coordinateToPointAtRes(
|
|
1193
|
+
const s = A.containerPointToCoordinate(e);
|
|
1194
|
+
return A.coordinateToPointAtRes(s, t);
|
|
1203
1195
|
}
|
|
1204
|
-
}(
|
|
1205
|
-
return Math.sqrt(Math.pow(
|
|
1196
|
+
}(e, g, e.getGLRes());
|
|
1197
|
+
return Math.sqrt(Math.pow(r.x - n[0], 2) + Math.pow(r.y - n[1], 2)) / 5.272881136101205;
|
|
1206
1198
|
}
|
|
1207
1199
|
|
|
1208
|
-
function
|
|
1200
|
+
function l(A, e) {
|
|
1209
1201
|
if (!A) return e;
|
|
1210
1202
|
const t = A.distanceToPointAtRes(e[0], e[1], A.getGLRes()), i = A.altitudeToPoint(e[2], A.getGLRes());
|
|
1211
|
-
return s.set([],
|
|
1203
|
+
return s.set([], Q(t.x, e[0]), Q(t.y, e[1]), Q(i, e[2]));
|
|
1212
1204
|
}
|
|
1213
1205
|
|
|
1214
|
-
class
|
|
1206
|
+
class P {
|
|
1215
1207
|
constructor(A) {
|
|
1216
1208
|
this.A = A, this._meshes = this.t();
|
|
1217
1209
|
}
|
|
@@ -1219,7 +1211,7 @@ class D {
|
|
|
1219
1211
|
this.A = A;
|
|
1220
1212
|
}
|
|
1221
1213
|
t() {
|
|
1222
|
-
const A = [], e = 340 / 177, 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);
|
|
1223
1215
|
return A.push(t, s, i, n), A;
|
|
1224
1216
|
}
|
|
1225
1217
|
getMeshes() {
|
|
@@ -1227,7 +1219,7 @@ class D {
|
|
|
1227
1219
|
}
|
|
1228
1220
|
}
|
|
1229
1221
|
|
|
1230
|
-
class
|
|
1222
|
+
class D {
|
|
1231
1223
|
constructor(A) {
|
|
1232
1224
|
this.A = A, this._meshes = this.t();
|
|
1233
1225
|
}
|
|
@@ -1235,15 +1227,15 @@ class u {
|
|
|
1235
1227
|
this.A = A;
|
|
1236
1228
|
}
|
|
1237
1229
|
t() {
|
|
1238
|
-
const A = [], e =
|
|
1239
|
-
return A.push(
|
|
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);
|
|
1231
|
+
return A.push(t), A;
|
|
1240
1232
|
}
|
|
1241
1233
|
getMeshes() {
|
|
1242
1234
|
return this._meshes;
|
|
1243
1235
|
}
|
|
1244
1236
|
}
|
|
1245
1237
|
|
|
1246
|
-
class
|
|
1238
|
+
class u {
|
|
1247
1239
|
constructor(A) {
|
|
1248
1240
|
this.A = A, this._meshes = this.t();
|
|
1249
1241
|
}
|
|
@@ -1251,15 +1243,15 @@ class m {
|
|
|
1251
1243
|
this.A = A;
|
|
1252
1244
|
}
|
|
1253
1245
|
t() {
|
|
1254
|
-
const A = [], e =
|
|
1255
|
-
return A.push(
|
|
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);
|
|
1247
|
+
return A.push(t), A;
|
|
1256
1248
|
}
|
|
1257
1249
|
getMeshes() {
|
|
1258
1250
|
return this._meshes;
|
|
1259
1251
|
}
|
|
1260
1252
|
}
|
|
1261
1253
|
|
|
1262
|
-
class
|
|
1254
|
+
class m {
|
|
1263
1255
|
constructor(A) {
|
|
1264
1256
|
this.A = A, this._meshes = this.t();
|
|
1265
1257
|
}
|
|
@@ -1267,7 +1259,7 @@ class b {
|
|
|
1267
1259
|
this.A = A;
|
|
1268
1260
|
}
|
|
1269
1261
|
t() {
|
|
1270
|
-
const A = [], e =
|
|
1262
|
+
const A = [], e = c("plane", [ 0, 0, 0 ], [ 0, 0, 0 ], [ 10, 10, 10 ], [ 1, 0, 0, .5 ], 16);
|
|
1271
1263
|
return A.push(e), A;
|
|
1272
1264
|
}
|
|
1273
1265
|
getMeshes() {
|
|
@@ -1275,7 +1267,7 @@ class b {
|
|
|
1275
1267
|
}
|
|
1276
1268
|
}
|
|
1277
1269
|
|
|
1278
|
-
class
|
|
1270
|
+
class b {
|
|
1279
1271
|
constructor(A) {
|
|
1280
1272
|
this.A = A, this._meshes = this.t();
|
|
1281
1273
|
}
|
|
@@ -1283,7 +1275,7 @@ class B {
|
|
|
1283
1275
|
this.A = A;
|
|
1284
1276
|
}
|
|
1285
1277
|
t() {
|
|
1286
|
-
const A = [], e =
|
|
1278
|
+
const A = [], e = c("xyzScale", [ 0, 0, 0 ], [ 0, 0, 0 ], [ 2, 2, 2 ], null, 113);
|
|
1287
1279
|
return A.push(e), A;
|
|
1288
1280
|
}
|
|
1289
1281
|
getMeshes() {
|
|
@@ -1291,48 +1283,48 @@ class B {
|
|
|
1291
1283
|
}
|
|
1292
1284
|
}
|
|
1293
1285
|
|
|
1294
|
-
const
|
|
1286
|
+
const B = [], y = [], p = [], v = [], L = [], M = [ 177 / 170, 177 / 170, 177 / 170 ], d = [], E = [ 1, 2, 3, 4, 12 ];
|
|
1295
1287
|
|
|
1296
|
-
class
|
|
1288
|
+
class O {
|
|
1297
1289
|
constructor() {
|
|
1298
|
-
this.translate = new
|
|
1299
|
-
this.xyzScaleHelper = new
|
|
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;
|
|
1300
1292
|
}
|
|
1301
1293
|
t() {
|
|
1302
1294
|
const A = {};
|
|
1303
1295
|
A.translate = this.translate.getMeshes(), A.rotation = this.rotation.getMeshes(),
|
|
1304
1296
|
A.scaling = this.scaling.getMeshes(), A.planeHelper = this.planeHelper.getMeshes(),
|
|
1305
1297
|
A.xyzScale = this.xyzScaleHelper.getMeshes();
|
|
1306
|
-
const e = 340 / 177, t =
|
|
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);
|
|
1307
1299
|
return A.translate.push(t, s, i, n, I, o), A;
|
|
1308
1300
|
}
|
|
1309
1301
|
updateMatrix(t, i, n, I, o) {
|
|
1310
|
-
const g = i.getCoordinates(), r = t.coordinateToPointAtRes(g, t.getGLRes()), C = i.
|
|
1311
|
-
s.set(
|
|
1312
|
-
const a = s.copy(
|
|
1313
|
-
s.add(
|
|
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);
|
|
1314
1306
|
for (const o in this._meshes) for (let g = 0; g < this._meshes[o].length; g++) {
|
|
1315
1307
|
const r = this._meshes[o][g];
|
|
1316
1308
|
for (let g = 0; g < r.length; g++) {
|
|
1317
|
-
const C = r[g], a = C.getUniform("uPickingId"), h = s.copy(
|
|
1318
|
-
let w = s.copy(
|
|
1309
|
+
const C = r[g], a = C.getUniform("uPickingId"), h = s.copy(B, C.translate);
|
|
1310
|
+
let w = s.copy(d, C.rotation);
|
|
1319
1311
|
const c = C.scaling;
|
|
1320
|
-
if (11 === a && (this.
|
|
1312
|
+
if (11 === a && (this.i ? (w[2] += n, C.rotation[2] += n) : this.i || (w[2] += n,
|
|
1321
1313
|
C.rotation[2] += n, w[0] = 360, w[2] -= 90)), a > 100 && 1 === i.getTargets().length && (w = i.getTargets()[0].getRotation()),
|
|
1322
|
-
|
|
1314
|
+
E.indexOf(a) > -1) if (12 !== a) c[0] += I, c[1] += I, c[2] += I; else {
|
|
1323
1315
|
const A = this._meshes.translate[4][0];
|
|
1324
1316
|
c[0] = 1.2 * A.scaling[0], c[1] = 1.2 * A.scaling[0], c[2] = 1.2 * A.scaling[0];
|
|
1325
1317
|
}
|
|
1326
|
-
let Q =
|
|
1327
|
-
if (Q = s.set(
|
|
1328
|
-
const A = s.multiply(
|
|
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);
|
|
1329
1321
|
s.multiply(h, h, A);
|
|
1330
1322
|
}
|
|
1331
|
-
const
|
|
1332
|
-
if (s.add(h, h,
|
|
1333
|
-
const A = e.fromRotationTranslationScale([],
|
|
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);
|
|
1334
1326
|
e.multiply(C.localTransform, A, C.originTransform);
|
|
1335
|
-
} else e.fromRotationTranslationScale(C.localTransform,
|
|
1327
|
+
} else e.fromRotationTranslationScale(C.localTransform, l, h, Q);
|
|
1336
1328
|
}
|
|
1337
1329
|
}
|
|
1338
1330
|
}
|
|
@@ -1341,8 +1333,8 @@ class F {
|
|
|
1341
1333
|
return A ? ("xyzScale" === A ? e[A] = this._meshes[A] : (e.translate = this._meshes.translate,
|
|
1342
1334
|
"translate" !== A && (e[A] = this._meshes[A])), e) : e;
|
|
1343
1335
|
}
|
|
1344
|
-
|
|
1345
|
-
this.
|
|
1336
|
+
o(A) {
|
|
1337
|
+
this.i = A;
|
|
1346
1338
|
}
|
|
1347
1339
|
dispose() {
|
|
1348
1340
|
for (const A in this._meshes) for (let e = 0; e < this._meshes[A].length; e++) {
|
|
@@ -1355,426 +1347,425 @@ class F {
|
|
|
1355
1347
|
}
|
|
1356
1348
|
}
|
|
1357
1349
|
|
|
1358
|
-
const
|
|
1350
|
+
const F = [], x = [], U = [], V = new o(0, 0), S = [], k = [], T = [], H = [ 0, 0, 0 ];
|
|
1359
1351
|
|
|
1360
|
-
class
|
|
1352
|
+
class J {
|
|
1361
1353
|
constructor() {
|
|
1362
|
-
this.
|
|
1354
|
+
this.C = [], this.h = [ 0, 0, 0 ], this.l = [ 1, 1, 1 ], this.P = [ 0, 0, 0 ];
|
|
1363
1355
|
}
|
|
1364
|
-
|
|
1365
|
-
Array.isArray(A) ? A.forEach(A => {
|
|
1366
|
-
this.
|
|
1367
|
-
}) : (A.on("remove", this.
|
|
1356
|
+
D(A) {
|
|
1357
|
+
Array.isArray(A) ? A.forEach((A => {
|
|
1358
|
+
this.D(A);
|
|
1359
|
+
})) : (A.on("remove", this.u, this), A.m = {
|
|
1368
1360
|
coordinate: A.getCoordinates(),
|
|
1369
1361
|
translation: A.getTranslation(),
|
|
1370
1362
|
rotation: A.getRotation(),
|
|
1371
1363
|
scale: A.getScale()
|
|
1372
|
-
}, this.
|
|
1364
|
+
}, this.C.push(A));
|
|
1373
1365
|
}
|
|
1374
|
-
|
|
1375
|
-
this.
|
|
1376
|
-
A.off("remove", this.
|
|
1377
|
-
}), this.
|
|
1366
|
+
B() {
|
|
1367
|
+
this.C.forEach((A => {
|
|
1368
|
+
A.off("remove", this.u, this);
|
|
1369
|
+
})), this.C = [];
|
|
1378
1370
|
}
|
|
1379
|
-
|
|
1380
|
-
for (let o = 0; o < this.
|
|
1381
|
-
const g = this.
|
|
1371
|
+
p(A, e, t, i, n, I, o) {
|
|
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);
|
|
1382
1374
|
let h = null;
|
|
1383
1375
|
h = i >= 0 ? i : i * (this.options && this.options.scaleStrength || 1);
|
|
1384
|
-
const w = s.add(
|
|
1376
|
+
const w = s.add(T, s.set(F, h * C[0], h * C[1], h * C[2]), C), c = Math.min(...w);
|
|
1385
1377
|
if (Math.abs(c) < n) {
|
|
1386
1378
|
const A = Math.abs(c);
|
|
1387
1379
|
w[0] = w[0] * (n / A), w[1] = w[1] * (n / A), w[2] = w[2] * (n / A);
|
|
1388
1380
|
}
|
|
1389
1381
|
const Q = s.add(r, t, r);
|
|
1390
|
-
g.setCoordinates(a), this.
|
|
1382
|
+
g.setCoordinates(a), this.L(A, w, C);
|
|
1391
1383
|
const f = g.getTranslation();
|
|
1392
1384
|
g.setTRS(f, Q, w);
|
|
1393
1385
|
}
|
|
1394
|
-
s.set(
|
|
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),
|
|
1395
1387
|
A.indexOf("translate") > -1 ? o.fire("positionchange", {
|
|
1396
1388
|
action: A,
|
|
1397
1389
|
type: "positionchange",
|
|
1398
|
-
target: this.
|
|
1390
|
+
target: this.C,
|
|
1399
1391
|
center: this.getCoordinates(),
|
|
1400
|
-
scale: this.
|
|
1401
|
-
rotation: this.
|
|
1402
|
-
translation: this.
|
|
1392
|
+
scale: this.l,
|
|
1393
|
+
rotation: this.P,
|
|
1394
|
+
translation: this.h,
|
|
1403
1395
|
deltaTranslate: e,
|
|
1404
1396
|
deltaRotation: t,
|
|
1405
1397
|
deltaScale: i
|
|
1406
1398
|
}) : o.fire("transforming", {
|
|
1407
1399
|
action: A,
|
|
1408
1400
|
type: "transforming",
|
|
1409
|
-
target: this.
|
|
1410
|
-
center: this.
|
|
1411
|
-
scale: this.
|
|
1412
|
-
rotation: this.
|
|
1413
|
-
translation: this.
|
|
1401
|
+
target: this.C,
|
|
1402
|
+
center: this.C[0].getTransformOrigin(),
|
|
1403
|
+
scale: this.l,
|
|
1404
|
+
rotation: this.P,
|
|
1405
|
+
translation: this.h,
|
|
1414
1406
|
deltaTranslate: e,
|
|
1415
1407
|
deltaRotation: t,
|
|
1416
1408
|
deltaScale: i
|
|
1417
1409
|
});
|
|
1418
1410
|
}
|
|
1419
|
-
|
|
1420
|
-
const g = i.getCenter(), r = i.getTransformOrigin(), C = t.getGLRes(), a = t.coordinateToPointAtRes(g, C,
|
|
1421
|
-
a.z = t.altitudeToPoint(g.z, C), s.set(
|
|
1422
|
-
const h = t.coordinateToPointAtRes(r, C,
|
|
1423
|
-
h.z = t.altitudeToPoint(r.z, C), s.set(
|
|
1424
|
-
const w = s.sub(
|
|
1425
|
-
s.set(
|
|
1426
|
-
const Q = e.fromRotationTranslationScale(
|
|
1427
|
-
s.transformMat4(w, w, Q), s.add(w, w,
|
|
1428
|
-
const f = t.pointAtResToCoordinate(
|
|
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);
|
|
1429
1421
|
return f.z = w[2] / t.altitudeToPoint(1, C), f;
|
|
1430
1422
|
}
|
|
1431
|
-
|
|
1423
|
+
L(A, e, t) {
|
|
1432
1424
|
return "x-scale" === A && (e[1] = t[1], e[2] = t[2]), "y-scale" === A && (e[0] = t[0],
|
|
1433
1425
|
e[2] = t[2]), "z-scale" === A && (e[0] = t[0], e[1] = t[1]), e;
|
|
1434
1426
|
}
|
|
1435
|
-
|
|
1436
|
-
this.
|
|
1437
|
-
if (A.
|
|
1438
|
-
const {coordinate: e, translation: t, rotation: s, scale: i} = A.
|
|
1427
|
+
M() {
|
|
1428
|
+
this.C.forEach((A => {
|
|
1429
|
+
if (A.m) {
|
|
1430
|
+
const {coordinate: e, translation: t, rotation: s, scale: i} = A.m;
|
|
1439
1431
|
A.setCoordinates(e), A.setTRS(t, s, i);
|
|
1440
1432
|
}
|
|
1441
|
-
});
|
|
1433
|
+
}));
|
|
1442
1434
|
}
|
|
1443
1435
|
getScale() {
|
|
1444
|
-
return this.
|
|
1436
|
+
return this.l;
|
|
1445
1437
|
}
|
|
1446
1438
|
getTranslation() {
|
|
1447
|
-
return 1 === this.
|
|
1439
|
+
return 1 === this.C.length && this.C[0].getTranslation() || H;
|
|
1448
1440
|
}
|
|
1449
1441
|
getRotation() {
|
|
1450
|
-
return this.
|
|
1442
|
+
return this.P;
|
|
1451
1443
|
}
|
|
1452
|
-
|
|
1453
|
-
return this.
|
|
1444
|
+
O() {
|
|
1445
|
+
return this.C[0] ? this.C[0].getLayer() : null;
|
|
1454
1446
|
}
|
|
1455
1447
|
getCoordinates() {
|
|
1456
1448
|
let A = 0, e = 0, t = 0;
|
|
1457
|
-
const s = this.
|
|
1449
|
+
const s = this.C.length;
|
|
1458
1450
|
if (!s) return null;
|
|
1459
1451
|
for (let i = 0; i < s; i++) {
|
|
1460
|
-
const s = this.
|
|
1452
|
+
const s = this.C[i].getCenter();
|
|
1461
1453
|
A += s.x, e += s.y, t += s.z || 0;
|
|
1462
1454
|
}
|
|
1463
1455
|
A /= s, e /= s, t /= s;
|
|
1464
1456
|
const i = new g(A, e, t);
|
|
1465
|
-
for (let A = 0; A < s; A++) this.
|
|
1457
|
+
for (let A = 0; A < s; A++) this.C[A].setTransformOrigin(i);
|
|
1466
1458
|
return i;
|
|
1467
1459
|
}
|
|
1468
|
-
|
|
1469
|
-
const e = A.target, t = this.
|
|
1470
|
-
t > -1 && (delete e.
|
|
1460
|
+
u(A) {
|
|
1461
|
+
const e = A.target, t = this.C.indexOf(e);
|
|
1462
|
+
t > -1 && (delete e.m, this.C.splice(t, 1));
|
|
1471
1463
|
}
|
|
1472
1464
|
getTargets() {
|
|
1473
|
-
return this.
|
|
1465
|
+
return this.C;
|
|
1474
1466
|
}
|
|
1475
|
-
|
|
1467
|
+
I() {
|
|
1476
1468
|
let A = 0;
|
|
1477
|
-
const e = this.
|
|
1469
|
+
const e = this.C.length;
|
|
1478
1470
|
for (let t = 0; t < e; t++) {
|
|
1479
|
-
A += this.
|
|
1471
|
+
A += this.C[t].getPointZ();
|
|
1480
1472
|
}
|
|
1481
1473
|
return A /= e, A;
|
|
1482
1474
|
}
|
|
1483
|
-
|
|
1484
|
-
for (let A = 0; A < this.
|
|
1475
|
+
F() {
|
|
1476
|
+
for (let A = 0; A < this.C.length; A++) if (this.C[A].isVisible()) return !0;
|
|
1485
1477
|
return !1;
|
|
1486
1478
|
}
|
|
1487
1479
|
}
|
|
1488
1480
|
|
|
1489
|
-
const
|
|
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 = [];
|
|
1490
1482
|
|
|
1491
|
-
class
|
|
1483
|
+
class eA extends(r(C(a))){
|
|
1492
1484
|
constructor(A = {}) {
|
|
1493
|
-
super(A), this.options = A, this.mouseAction = "moving", this.
|
|
1494
|
-
this.
|
|
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([]),
|
|
1495
1487
|
this.addToMapCount = 0;
|
|
1496
1488
|
}
|
|
1497
1489
|
enable() {
|
|
1498
|
-
return this.
|
|
1490
|
+
return this.V = !0, this.layerRenderer && this.layerRenderer.setToRedraw(), this;
|
|
1499
1491
|
}
|
|
1500
1492
|
disable() {
|
|
1501
|
-
return this.
|
|
1493
|
+
return this.V = !1, this.layerRenderer && this.layerRenderer.setToRedraw(), this.map && this.map.resetCursor(),
|
|
1502
1494
|
this;
|
|
1503
1495
|
}
|
|
1504
1496
|
setMode(A) {
|
|
1505
|
-
this.
|
|
1497
|
+
this.U = A, this.k(), this.layerRenderer && this.layerRenderer.setToRedraw(), this.fire("modechange", {
|
|
1506
1498
|
mode: A,
|
|
1507
1499
|
type: "modechange"
|
|
1508
1500
|
});
|
|
1509
1501
|
}
|
|
1510
1502
|
getMode() {
|
|
1511
|
-
return this.
|
|
1503
|
+
return this.U;
|
|
1512
1504
|
}
|
|
1513
1505
|
isEnable() {
|
|
1514
|
-
return this.
|
|
1506
|
+
return this.V;
|
|
1515
1507
|
}
|
|
1516
|
-
|
|
1517
|
-
|
|
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");
|
|
1518
1510
|
}
|
|
1519
|
-
|
|
1520
|
-
return this.
|
|
1511
|
+
H() {
|
|
1512
|
+
return this.U;
|
|
1521
1513
|
}
|
|
1522
1514
|
addTo(A) {
|
|
1523
|
-
this.map && (this.
|
|
1524
|
-
this.addToMapCount++, this.map = A, this.container = A.getContainer(), A.on("dom:mousemove", this.
|
|
1525
|
-
A.on("dom:mousedown", this.
|
|
1526
|
-
this.
|
|
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();
|
|
1527
1519
|
}
|
|
1528
1520
|
remove() {
|
|
1529
|
-
this.map && this.container && this.layerRenderer && (this.
|
|
1521
|
+
this.map && this.container && this.layerRenderer && (this.J(), this.TransformHelper.dispose(),
|
|
1530
1522
|
this.layerRenderer.setToRedraw(), delete this.map, delete this.layer, delete this.layerRenderer,
|
|
1531
|
-
delete this.container, delete this.
|
|
1523
|
+
delete this.container, delete this.S);
|
|
1532
1524
|
}
|
|
1533
|
-
|
|
1534
|
-
this.container && this.map && (this.map.off("dom:mousemove", this.
|
|
1535
|
-
this.map.off("dom:mouseup", this.
|
|
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),
|
|
1536
1528
|
this.layer && this.layer.off("renderend", this.render, this));
|
|
1537
1529
|
}
|
|
1538
|
-
|
|
1539
|
-
if (this.
|
|
1530
|
+
N(A) {
|
|
1531
|
+
if (this.j()) {
|
|
1540
1532
|
if (this.currentMousePosition = {
|
|
1541
1533
|
x: A.containerPoint.x,
|
|
1542
1534
|
y: A.containerPoint.y
|
|
1543
1535
|
}, "moving" === this.mouseAction) {
|
|
1544
|
-
const A = this.
|
|
1545
|
-
this.currentPickingObject = this.
|
|
1546
|
-
6 === this.currentPickingObject.pickingId ? this.
|
|
1547
|
-
this.
|
|
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();
|
|
1548
1540
|
}
|
|
1549
|
-
this.
|
|
1541
|
+
this.X(this.currentMousePosition);
|
|
1550
1542
|
}
|
|
1551
1543
|
}
|
|
1552
|
-
|
|
1553
|
-
if (!this.
|
|
1554
|
-
const e = this.
|
|
1544
|
+
R(A) {
|
|
1545
|
+
if (!this.j() || 0 !== A.domEvent.button) return;
|
|
1546
|
+
const e = this.Z();
|
|
1555
1547
|
this.currentMousePosition = {
|
|
1556
1548
|
x: A.containerPoint.x,
|
|
1557
1549
|
y: A.containerPoint.y
|
|
1558
|
-
}, this
|
|
1559
|
-
this.firstDownPoint = this.
|
|
1560
|
-
this.
|
|
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),
|
|
1561
1553
|
this.layerRenderer && this.layerRenderer.setToRedraw()) : (this.mouseAction = "pan",
|
|
1562
|
-
this.map.config("zoomable", !0), this.map.config("draggable", !0), this.
|
|
1554
|
+
this.map.config("zoomable", !0), this.map.config("draggable", !0), this.k()), this.lastMousePosition = this.currentMousePosition,
|
|
1563
1555
|
this.lastPickingObject = this.currentPickingObject, this.lastPickingMesh = e[this.currentPickingObject.meshId];
|
|
1564
1556
|
}
|
|
1565
|
-
|
|
1566
|
-
"transform" === this.mouseAction && (this.firstDownPoint = null, this.
|
|
1557
|
+
_() {
|
|
1558
|
+
"transform" === this.mouseAction && (this.firstDownPoint = null, this.k(), this.$ = !0,
|
|
1567
1559
|
this.fire("transformend", {
|
|
1568
|
-
action: this
|
|
1560
|
+
action: this.eA,
|
|
1569
1561
|
type: "transformend"
|
|
1570
|
-
})), this.mouseAction = "moving", "xyzScale" !== this.
|
|
1562
|
+
})), this.mouseAction = "moving", "xyzScale" !== this.U && (this.U = "translate"),
|
|
1571
1563
|
this.map.config("zoomable", !0), this.map.config("draggable", !0), this.layerRenderer && this.layerRenderer.setToRedraw();
|
|
1572
1564
|
}
|
|
1573
|
-
|
|
1565
|
+
K() {
|
|
1574
1566
|
const A = this.TransformHelper.planeHelper.getMeshes()[0][0], e = this.map.getBearing();
|
|
1575
|
-
A.rotation[2] = -e, this.
|
|
1567
|
+
A.rotation[2] = -e, this.tA();
|
|
1576
1568
|
}
|
|
1577
|
-
|
|
1578
|
-
this.
|
|
1579
|
-
this
|
|
1569
|
+
tA() {
|
|
1570
|
+
this.j() && (this.TransformHelper.updateMatrix(this.map, this.S, 0, 0, [ 0, 0, 0 ]),
|
|
1571
|
+
this.$ = !0);
|
|
1580
1572
|
}
|
|
1581
1573
|
picked(A) {
|
|
1582
1574
|
if (!this.layerRenderer) return !1;
|
|
1583
|
-
const e = this.
|
|
1575
|
+
const e = this.Z(), t = this.map;
|
|
1584
1576
|
let s = A;
|
|
1585
1577
|
A instanceof o || (s = t.coordinateToContainerPoint(new g(A)));
|
|
1586
|
-
const i = this.
|
|
1578
|
+
const i = this.Y(s, e, "picked");
|
|
1587
1579
|
return !(!i || null === i.meshId);
|
|
1588
1580
|
}
|
|
1589
|
-
|
|
1590
|
-
const A = this.TransformHelper.getMeshes("scaling").scaling[0][0];
|
|
1591
|
-
A.scaling = [
|
|
1592
|
-
this.tA());
|
|
1581
|
+
k() {
|
|
1582
|
+
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());
|
|
1593
1584
|
}
|
|
1594
|
-
|
|
1595
|
-
this.TransformHelper._meshes.translate.forEach(A => {
|
|
1585
|
+
iA() {
|
|
1586
|
+
this.TransformHelper._meshes.translate.forEach((A => {
|
|
1596
1587
|
for (let e = 0; e < A.length; e++) {
|
|
1597
1588
|
const t = A[e];
|
|
1598
|
-
|
|
1589
|
+
G.indexOf(t.getUniform("uPickingId")) > -1 && t.material.set("color", t.originColor);
|
|
1599
1590
|
}
|
|
1600
|
-
});
|
|
1591
|
+
}));
|
|
1601
1592
|
}
|
|
1602
|
-
|
|
1603
|
-
const i = this.
|
|
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());
|
|
1604
1595
|
s.add(I, I, o);
|
|
1605
1596
|
const g = s.copy([], t.translate), r = t.scaling;
|
|
1606
|
-
let C =
|
|
1597
|
+
let C = f(this.S, this.map);
|
|
1607
1598
|
C = s.set([], C, C, C), s.multiply(g, g, C), s.multiply(C, C, r), s.add(g, g, I),
|
|
1608
1599
|
e.fromRotationTranslationScale(t.localTransform, [ 0, 0, 0, 1 ], g, C);
|
|
1609
|
-
this.
|
|
1600
|
+
this.Z().forEach((t => {
|
|
1610
1601
|
const i = t.getUniform("uPickingId");
|
|
1611
1602
|
if (1 === i || 3 === i || 2 === i || 4 === i) {
|
|
1612
1603
|
const i = s.copy([], t.translate), n = 170 / 177;
|
|
1613
1604
|
t.scaling = [ n, n, n ];
|
|
1614
1605
|
const o = t.scaling, g = t.rotation;
|
|
1615
|
-
let r =
|
|
1606
|
+
let r = f(this.S, this.map);
|
|
1616
1607
|
r = s.set([], r, r, r), s.multiply(i, i, r), s.multiply(r, r, o), s.add(i, i, I);
|
|
1617
1608
|
const C = A.fromEuler([], g[0], g[1], g[2]);
|
|
1618
1609
|
e.fromRotationTranslationScale(t.localTransform, C, i, r);
|
|
1619
1610
|
}
|
|
1620
|
-
});
|
|
1611
|
+
}));
|
|
1621
1612
|
}
|
|
1622
|
-
|
|
1613
|
+
nA(A) {
|
|
1623
1614
|
const e = this.map.containerPointToCoordinate(A), t = this.map.coordinateToPointAtRes(e, this.map.getGLRes());
|
|
1624
1615
|
return {
|
|
1625
1616
|
point: [ t.x, t.y ]
|
|
1626
1617
|
};
|
|
1627
1618
|
}
|
|
1628
|
-
|
|
1619
|
+
X(A) {
|
|
1629
1620
|
if ("transform" === this.mouseAction) {
|
|
1630
|
-
const A = this.
|
|
1621
|
+
const A = this.H(), e = l(this.map, this.S.getTranslation()), t = this.S.I();
|
|
1631
1622
|
let s = null, n = null;
|
|
1632
|
-
if (e[2] + t < .01 && "z-translate" !== this
|
|
1633
|
-
n = this.
|
|
1623
|
+
if (e[2] + t < .01 && "z-translate" !== this.eA) s = this.nA(this.currentMousePosition),
|
|
1624
|
+
n = this.nA(this.lastMousePosition); else {
|
|
1634
1625
|
const A = this.TransformHelper.planeHelper.getMeshes()[0];
|
|
1635
|
-
if (s = this.
|
|
1626
|
+
if (s = this.Y(this.currentMousePosition, A, "plane"), n = this.Y(this.lastMousePosition, A, "plane"),
|
|
1636
1627
|
!s || null === s.meshId || !n || null === n.meshId) return;
|
|
1637
1628
|
}
|
|
1638
1629
|
const I = [ 0, 0, 0 ], g = [ 0, 0, 0 ];
|
|
1639
1630
|
let r = 0, C = 0, a = 0;
|
|
1640
1631
|
if ("translate" === A) {
|
|
1641
|
-
if ("xy-translate" === this
|
|
1632
|
+
if ("xy-translate" === this.eA) {
|
|
1642
1633
|
const A = s.point[0] - n.point[0], e = s.point[1] - n.point[1];
|
|
1643
1634
|
I[0] = A, I[1] = e;
|
|
1644
|
-
} else if ("x-translate" === this
|
|
1635
|
+
} else if ("x-translate" === this.eA) {
|
|
1645
1636
|
const A = s.point[0] - n.point[0];
|
|
1646
1637
|
I[0] = A;
|
|
1647
|
-
} else if ("y-translate" === this
|
|
1638
|
+
} else if ("y-translate" === this.eA) {
|
|
1648
1639
|
const A = s.point[1] - n.point[1];
|
|
1649
1640
|
I[1] = A;
|
|
1650
|
-
} else if ("z-translate" === this
|
|
1641
|
+
} else if ("z-translate" === this.eA) {
|
|
1651
1642
|
let A = 0;
|
|
1652
|
-
if (this.
|
|
1653
|
-
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(
|
|
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]));
|
|
1654
1645
|
A = I.y < t.y ? g : -g;
|
|
1655
1646
|
} else A = s.point[2] - n.point[2];
|
|
1656
1647
|
I[2] = A;
|
|
1657
1648
|
}
|
|
1658
|
-
} else if ("rotation" === A) C = this.
|
|
1649
|
+
} else if ("rotation" === A) C = this.oA(s.point, n.point), C >= 0 ? this.TransformHelper.o(!0) : this.TransformHelper.o(!1),
|
|
1659
1650
|
g[2] += C; else if ("scaling" === A || "xyzScale" === A) {
|
|
1660
|
-
const A = this.
|
|
1661
|
-
r = this.
|
|
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);
|
|
1662
1653
|
}
|
|
1663
|
-
this.TransformHelper.updateMatrix(this.map, this.
|
|
1654
|
+
this.TransformHelper.updateMatrix(this.map, this.S, C, a, I), this.S.p(this.eA, I, g, r, .01, this.map, this);
|
|
1664
1655
|
}
|
|
1665
1656
|
this.lastMousePosition = A, this.lastPickingObject = this.currentPickingObject;
|
|
1666
|
-
const e = this.
|
|
1657
|
+
const e = this.Z();
|
|
1667
1658
|
this.lastPickingMesh = e[this.currentPickingObject.meshId];
|
|
1668
1659
|
}
|
|
1669
|
-
|
|
1670
|
-
const I = (i.length(i.set(
|
|
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;
|
|
1671
1662
|
return n ? (n[0] - .01) * I : I;
|
|
1672
1663
|
}
|
|
1673
|
-
|
|
1674
|
-
const A = this.map, e = this.
|
|
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());
|
|
1675
1666
|
return s.add(i, i, n), i;
|
|
1676
1667
|
}
|
|
1677
|
-
|
|
1678
|
-
const i = this.TransformHelper.planeHelper.getMeshes()[0][0], n = e.getTranslation(
|
|
1679
|
-
let o = A.fromEuler(
|
|
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);
|
|
1680
1671
|
const g = this.map.getBearing();
|
|
1681
|
-
t && !this.
|
|
1682
|
-
s.set(i.rotation, 90, 0, -g)) : (90 === i.rotation[0] && (this
|
|
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)),
|
|
1683
1674
|
e.fromRotationTranslationScale(i.localTransform, o, n, I);
|
|
1684
1675
|
}
|
|
1685
|
-
|
|
1676
|
+
IA() {
|
|
1686
1677
|
if (this.map.getPitch()) return !1;
|
|
1687
1678
|
const A = this.map.cameraPosition, e = this.map.coordinateToPointAtRes(this.map.getCenter(), this.map.getGLRes());
|
|
1688
1679
|
s.set(e, e.x, e.y, 0);
|
|
1689
|
-
const t = this.
|
|
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);
|
|
1690
1681
|
return s.angle(g, r) < 1 / 180 * Math.PI;
|
|
1691
1682
|
}
|
|
1692
|
-
|
|
1693
|
-
const A = this.
|
|
1683
|
+
q() {
|
|
1684
|
+
const A = this.Z();
|
|
1694
1685
|
if (this.currentPickingObject && null != this.currentPickingObject.meshId) {
|
|
1695
|
-
this.
|
|
1686
|
+
this.CA(), this.lastPickingObject && null != this.lastPickingObject.meshId && this.lastPickingObject.meshId !== this.currentPickingObject.meshId && this.aA();
|
|
1696
1687
|
const e = A[this.currentPickingObject.meshId];
|
|
1697
|
-
if (e &&
|
|
1688
|
+
if (e && z.indexOf(this.currentPickingObject.pickingId) < 0) if (this.currentPickingObject.pickingId > 100) this.hA(e); else {
|
|
1698
1689
|
const A = [ e.originColor[0], e.originColor[1], e.originColor[2], .8 ];
|
|
1699
|
-
e.material.set("color", A), this.
|
|
1690
|
+
e.material.set("color", A), this.wA(e, .5);
|
|
1700
1691
|
}
|
|
1701
1692
|
this.layerRenderer.setToRedraw();
|
|
1702
1693
|
} else this.lastPickingObject && null != this.lastPickingObject.meshId && (this.map.resetCursor(),
|
|
1703
|
-
this.
|
|
1694
|
+
this.aA(), this.layerRenderer.setToRedraw());
|
|
1704
1695
|
}
|
|
1705
|
-
|
|
1696
|
+
hA(A) {
|
|
1706
1697
|
const e = [ 1, 179 / 255, 2 / 255, 1 ];
|
|
1707
|
-
A.material.set("color", e), A.properties.relatedMeshes && A.properties.relatedMeshes.forEach(A => {
|
|
1698
|
+
A.material.set("color", e), A.properties.relatedMeshes && A.properties.relatedMeshes.forEach((A => {
|
|
1708
1699
|
A.material.set("color", e);
|
|
1709
|
-
});
|
|
1700
|
+
}));
|
|
1710
1701
|
}
|
|
1711
|
-
|
|
1712
|
-
6 === this.currentPickingObject.pickingId ? this.map.setCursor("ns-resize") :
|
|
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");
|
|
1713
1704
|
}
|
|
1714
|
-
|
|
1705
|
+
aA() {
|
|
1715
1706
|
const A = this.lastPickingMesh;
|
|
1716
1707
|
if (!A) return;
|
|
1717
|
-
const e = A.getUniform("uPickingId"), t = this.
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
}) :
|
|
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 => {
|
|
1721
1712
|
const e = A.getUniform("uPickingId");
|
|
1722
|
-
|
|
1723
|
-
}) : 11 === e && t.forEach(A => {
|
|
1724
|
-
|
|
1725
|
-
}), A.material.set("color", A.originColor), A.properties.relatedMeshes && A.properties.relatedMeshes.forEach(A => {
|
|
1713
|
+
G.indexOf(e) > -1 && A.material.set("color", A.originColor);
|
|
1714
|
+
})) : 11 === e && t.forEach((A => {
|
|
1715
|
+
G.indexOf(A.getUniform("uPickingId")) > -1 && A.material.set("color", A.originColor);
|
|
1716
|
+
})), A.material.set("color", A.originColor), A.properties.relatedMeshes && A.properties.relatedMeshes.forEach((A => {
|
|
1726
1717
|
A.material.set("color", A.originColor);
|
|
1727
|
-
});
|
|
1718
|
+
}));
|
|
1728
1719
|
}
|
|
1729
|
-
|
|
1730
|
-
const t = A.getUniform("uPickingId"), s = this.
|
|
1731
|
-
|
|
1732
|
-
if (
|
|
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")) {
|
|
1733
1724
|
const A = [ t.originColor[0], t.originColor[1], t.originColor[2], e ];
|
|
1734
1725
|
t.material.set("color", A);
|
|
1735
1726
|
}
|
|
1736
|
-
}) : "scaling" === this.
|
|
1727
|
+
})) : "scaling" === this.U ? s.forEach((A => {
|
|
1737
1728
|
const e = A.getUniform("uPickingId");
|
|
1738
1729
|
if (1 === e || 3 === e || 2 === e || 4 === e) {
|
|
1739
1730
|
const e = [ 149 / 255, 179 / 255, 199 / 255, .8 ];
|
|
1740
1731
|
A.material.set("color", e);
|
|
1741
1732
|
}
|
|
1742
|
-
}) : "rotation" === this.
|
|
1733
|
+
})) : "rotation" === this.U && s.forEach((A => {
|
|
1743
1734
|
const e = A.getUniform("uPickingId");
|
|
1744
1735
|
if (1 === e || 3 === e || 2 === e || 4 === e) {
|
|
1745
1736
|
const e = A.originColor;
|
|
1746
1737
|
A.material.set("color", [ e[0], e[1], e[2], 0 ]);
|
|
1747
1738
|
}
|
|
1748
|
-
});
|
|
1739
|
+
}));
|
|
1749
1740
|
}
|
|
1750
1741
|
reset() {
|
|
1751
|
-
this.map && this.
|
|
1742
|
+
this.map && this.S && (this.S.M(), this.TransformHelper.updateMatrix(this.map, this.S, 0, 0, [ 0, 0, 0 ]));
|
|
1752
1743
|
}
|
|
1753
|
-
|
|
1754
|
-
const t = this.
|
|
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]);
|
|
1755
1746
|
return (Math.atan2(n[1], n[0]) - I) / Math.PI * 180;
|
|
1756
1747
|
}
|
|
1757
|
-
|
|
1758
|
-
return this
|
|
1759
|
-
this
|
|
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;
|
|
1760
1751
|
}
|
|
1761
1752
|
transform(A) {
|
|
1762
1753
|
if (!A) return;
|
|
1763
1754
|
if (this.layerRenderer && this.layerRenderer.layer && (this.layerRenderer.layer.off("renderend", this.render),
|
|
1764
|
-
this.layerRenderer.layer.off("resizeCanvas", this.
|
|
1765
|
-
if (this.
|
|
1755
|
+
this.layerRenderer.layer.off("resizeCanvas", this.cA)), !this.map) return void console.error("should add to a target first");
|
|
1756
|
+
if (this.S && (this.S.B(), this.S.D(A)), !this.S.getTargets().length) return;
|
|
1766
1757
|
const e = this.map;
|
|
1767
|
-
this.TransformHelper.updateMatrix(e, this.
|
|
1758
|
+
this.TransformHelper.updateMatrix(e, this.S, 0, 0, [ 0, 0, 0 ]), this.QA(), this.$ = !0;
|
|
1768
1759
|
}
|
|
1769
1760
|
getTransformTarget() {
|
|
1770
|
-
return this.
|
|
1761
|
+
return this.S;
|
|
1771
1762
|
}
|
|
1772
|
-
|
|
1773
|
-
delete this.
|
|
1763
|
+
u() {
|
|
1764
|
+
delete this.S;
|
|
1774
1765
|
}
|
|
1775
|
-
|
|
1776
|
-
const A = this.
|
|
1777
|
-
A && (A.off("renderend", this.render), A.off("resizeCanvas", this.
|
|
1766
|
+
QA() {
|
|
1767
|
+
const A = this.S.O();
|
|
1768
|
+
A && (A.off("renderend", this.render), A.off("resizeCanvas", this.cA));
|
|
1778
1769
|
const e = this.map.getLayers();
|
|
1779
1770
|
let t = null;
|
|
1780
1771
|
for (let A = 0; A < e.length; A++) if (e[A] instanceof n) {
|
|
@@ -1786,37 +1777,37 @@ class tA extends(r(C(a))){
|
|
|
1786
1777
|
if (i < 0) return;
|
|
1787
1778
|
s.splice(i, 1), s.push(A);
|
|
1788
1779
|
const I = this.map, o = A.getRenderer();
|
|
1789
|
-
this.layerRenderer = o, this.regl = o.regl, this.renderer = o.renderer, this.
|
|
1790
|
-
this.
|
|
1780
|
+
this.layerRenderer = o, this.regl = o.regl, this.renderer = o.renderer, this.fA = this.layerRenderer.getFBORayPicking(),
|
|
1781
|
+
this.lA = {
|
|
1791
1782
|
projViewMatrix: I.projViewMatrix,
|
|
1792
1783
|
projMatrix: I.projMatrix,
|
|
1793
1784
|
viewMatrix: I.viewMatrix,
|
|
1794
1785
|
pointSize: 1
|
|
1795
|
-
}, A.on("renderend", this.render, this), A.on("resizeCanvas", this.
|
|
1786
|
+
}, A.on("renderend", this.render, this), A.on("resizeCanvas", this.cA, this), o.setToRedraw();
|
|
1796
1787
|
}
|
|
1797
|
-
|
|
1798
|
-
this.
|
|
1788
|
+
cA() {
|
|
1789
|
+
this.fA.clear(), this.$ = !0;
|
|
1799
1790
|
}
|
|
1800
|
-
|
|
1791
|
+
Y(A, e, t) {
|
|
1801
1792
|
const s = this.map;
|
|
1802
|
-
if (!(s && this.
|
|
1803
|
-
const i = s.getDevicePixelRatio(), n = A.x * i, I = A.y * i, o = this.
|
|
1804
|
-
(this
|
|
1805
|
-
this
|
|
1806
|
-
return this.
|
|
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, {
|
|
1807
1798
|
viewMatrix: this.map.viewMatrix,
|
|
1808
1799
|
projMatrix: this.map.projMatrix,
|
|
1809
1800
|
returnPoint: !0
|
|
1810
1801
|
});
|
|
1811
1802
|
}
|
|
1812
|
-
|
|
1803
|
+
G() {
|
|
1813
1804
|
const A = this.map.getDevicePixelRatio(), s = {
|
|
1814
1805
|
x: 0,
|
|
1815
1806
|
y: 0,
|
|
1816
1807
|
width: () => this.map ? this.map.width * A : 1,
|
|
1817
1808
|
height: () => this.map ? this.map.height * A : 1
|
|
1818
1809
|
};
|
|
1819
|
-
this.
|
|
1810
|
+
this.DA = new t.MeshShader({
|
|
1820
1811
|
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",
|
|
1821
1812
|
frag: "precision mediump float;\n\nuniform vec4 color;\n\n\n\nvoid main() {\n\n gl_FragColor = color;\n\n}\n\n",
|
|
1822
1813
|
uniforms: [ "color", {
|
|
@@ -1847,18 +1838,18 @@ class tA extends(r(C(a))){
|
|
|
1847
1838
|
});
|
|
1848
1839
|
}
|
|
1849
1840
|
render() {
|
|
1850
|
-
if (!this.
|
|
1851
|
-
const A = this.
|
|
1841
|
+
if (!this.j()) return;
|
|
1842
|
+
const A = this.Z();
|
|
1852
1843
|
this.helperScene.setMeshes(A);
|
|
1853
1844
|
const e = this.layerRenderer.getFrameContext();
|
|
1854
1845
|
if (e && e.renderTarget && this.layerRenderer.getFrameTimestamp() !== e.timestamp) return;
|
|
1855
|
-
this.
|
|
1846
|
+
this.tA(), this.DA.filter = e && e.sceneFilter;
|
|
1856
1847
|
const t = e && e.renderTarget && e.renderTarget.fbo;
|
|
1857
|
-
this.renderer.render(this.
|
|
1848
|
+
this.renderer.render(this.DA, this.lA, this.helperScene, t);
|
|
1858
1849
|
}
|
|
1859
|
-
|
|
1850
|
+
Z() {
|
|
1860
1851
|
let A = [];
|
|
1861
|
-
const e = this.TransformHelper.getMeshes(this.
|
|
1852
|
+
const e = this.TransformHelper.getMeshes(this.U);
|
|
1862
1853
|
for (const t in e) {
|
|
1863
1854
|
if ("translate" === t) continue;
|
|
1864
1855
|
const s = e[t];
|
|
@@ -1868,16 +1859,17 @@ class tA extends(r(C(a))){
|
|
|
1868
1859
|
if (t) for (let e = 0; e < t.length; e++) A = A.concat(t[e]);
|
|
1869
1860
|
return A;
|
|
1870
1861
|
}
|
|
1871
|
-
|
|
1862
|
+
j() {
|
|
1872
1863
|
const A = this.layerRenderer, e = A && A.layer;
|
|
1873
|
-
return A && this.
|
|
1864
|
+
return A && this.S && e && e.isVisible() && this.S.F() && this.regl && this.V;
|
|
1874
1865
|
}
|
|
1875
1866
|
}
|
|
1876
1867
|
|
|
1877
|
-
|
|
1868
|
+
eA.mergeOptions({
|
|
1878
1869
|
scaleStrength: 2
|
|
1879
1870
|
});
|
|
1880
1871
|
|
|
1881
|
-
export {
|
|
1872
|
+
export { eA as TransformControl };
|
|
1882
1873
|
|
|
1883
|
-
"undefined" != typeof console && console.log("@maptalks/transform-control v0.
|
|
1874
|
+
"undefined" != typeof console && console.log("@maptalks/transform-control v0.98.0");
|
|
1875
|
+
//# sourceMappingURL=transform-control.es.js.map
|