@maptalks/transform-control 0.102.1 → 0.103.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.
|
|
2
|
+
* @maptalks/transform-control v0.103.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,
|
|
6
|
+
import { quat as A, mat4 as e, reshader as t, vec3 as s, vec2 as i } from "@maptalks/gl";
|
|
7
7
|
|
|
8
|
-
import * as
|
|
8
|
+
import * as n from "maptalks";
|
|
9
9
|
|
|
10
|
-
import { Point as
|
|
10
|
+
import { Point as I, Coordinate as o, Eventable as g, Handlerable as r, Class as a, INTERNAL_LAYER_PREFIX as C } from "maptalks";
|
|
11
11
|
|
|
12
|
-
import { GLTFLayer as
|
|
12
|
+
import { GLTFLayer as h, GLTFMarker as w } from "@maptalks/gltf-layer";
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const c = {
|
|
15
15
|
yuanhuan: {
|
|
16
16
|
accessors: [ {
|
|
17
17
|
name: "������_1_0_positions",
|
|
@@ -1154,39 +1154,59 @@ const Q = {
|
|
|
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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AAAIA/AACAPwAAAAAAAACAAACAvwAAAAAAAACAAAAAAAAAAAAAAIC/AAAAAAAAgD8AAACAAACAvwAAAAAAAACAAAAAAAAAgL8AAACAAAAAAAAAAAAAAIC/AACAvwAAAAAAAACAAAAAAAAAAAAAAIA/AAAAAAAAgD8AAACAAACAvwAAAAAAAACAAAAAAAAAgL8AAACAAAAAAAAAAAAAAIA/AAAgPwAAAD8AACA/AAAAPwAAID8AAAA/AADAPgAAAD8AAMA+AAAAPwAAwD4AAAA/AAAgPwAAgD4AACA/AACAPgAAID8AAIA+AADAPgAAgD4AAMA+AACAPgAAwD4AAIA+AAAgPwAAQD8AACA/AABAPwAAYD8AAAA/AADAPgAAQD8AAAA+AAAAPwAAwD4AAEA/AAAgPwAAgD8AACA/AAAAAAAAYD8AAIA+AADAPgAAgD8AAAA+AACAPgAAwD4AAAAA"
|
|
1155
1155
|
} ]
|
|
1156
1156
|
}
|
|
1157
|
+
}, Q = function() {
|
|
1158
|
+
if ("undefined" != typeof globalThis) return globalThis;
|
|
1159
|
+
if ("undefined" != typeof self) return self;
|
|
1160
|
+
if ("undefined" != typeof window) return window;
|
|
1161
|
+
if ("undefined" != typeof global) return global;
|
|
1162
|
+
throw new Error("unable to locate global object");
|
|
1163
|
+
}, f = Q(), l = f.gl_trans__coders = f.gl_trans__coders || {};
|
|
1164
|
+
|
|
1165
|
+
l.inject = function(A) {
|
|
1166
|
+
const e = A.toString(), t = e.indexOf("{") + 1, s = e.substring(0, t), i = f.gl_trans__coders = f.gl_trans__coders || {};
|
|
1167
|
+
let n = `${s}\n const _____getGlobal = ${Q.toString()};\n const g___lobals = _____getGlobal()\n const tran_____scoders = g___lobals['gl_trans__coders'] = g___lobals['gl_trans__coders'] || {};`;
|
|
1168
|
+
for (const A in i) "inject" !== A && "getTranscoder" !== A && "registerTranscoder" !== A && (n += 'tran_____scoders["' + A + '"] =' + i[A].toString() + "\n;");
|
|
1169
|
+
return n += "\n(" + Q().maptalks_gltf_loader_bundle.toString() + ")({});\n", n += "\n" + e.substring(s.length),
|
|
1170
|
+
n;
|
|
1171
|
+
}, l.registerTranscoder = function(A, e) {
|
|
1172
|
+
l[A] = e;
|
|
1173
|
+
}, l.getTranscoder = function(A) {
|
|
1174
|
+
return l[A];
|
|
1157
1175
|
};
|
|
1158
1176
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1177
|
+
const P = Q().maptalks_gltf_loader;
|
|
1178
|
+
|
|
1179
|
+
function D(s, i, n, I, o, g) {
|
|
1180
|
+
const r = [], a = A.fromEuler([], n[0], n[1], n[2]), C = e.fromRotationTranslationScale([], a, i, I), h = function(A) {
|
|
1181
|
+
return new P.GLTFLoader("", JSON.parse(JSON.stringify(c[A]))).load().then((A => A));
|
|
1162
1182
|
}(s);
|
|
1163
|
-
return
|
|
1183
|
+
return h.then((A => {
|
|
1164
1184
|
t.GLTFHelper.exportGLTFPack(A).getMeshesInfo().forEach(((A, s) => {
|
|
1165
|
-
const
|
|
1166
|
-
color:
|
|
1167
|
-
}),
|
|
1168
|
-
|
|
1169
|
-
const w =
|
|
1170
|
-
w.HAS_PICKING_ID = 2,
|
|
1171
|
-
e.multiply(
|
|
1172
|
-
|
|
1173
|
-
})),
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
})),
|
|
1185
|
+
const a = new t.Material({
|
|
1186
|
+
color: o || A.materialInfo.baseColorFactor
|
|
1187
|
+
}), h = new t.Mesh(A.geometry, a);
|
|
1188
|
+
h.setUniform("uPickingId", g + s);
|
|
1189
|
+
const w = h.getDefines();
|
|
1190
|
+
w.HAS_PICKING_ID = 2, h.setDefines(w), h.translate = i, h.rotation = n, h.scaling = I,
|
|
1191
|
+
e.multiply(h.localTransform, C, A.nodeMatrix), h.originTransform = e.copy([], h.localTransform),
|
|
1192
|
+
h.originColor = o || A.materialInfo.baseColorFactor, r.push(h);
|
|
1193
|
+
})), g > 100 && (r[0].properties.relatedMeshes = r.slice(1, 2), r[1].properties.relatedMeshes = r.slice(0, 1),
|
|
1194
|
+
r[2].properties.relatedMeshes = r.slice(3, 4), r[3].properties.relatedMeshes = r.slice(2, 3),
|
|
1195
|
+
r[4].properties.relatedMeshes = r.slice(5, 6), r[5].properties.relatedMeshes = r.slice(4, 5),
|
|
1196
|
+
r[6].properties.relatedMeshes = r.slice(0, 6));
|
|
1197
|
+
})), r;
|
|
1178
1198
|
}
|
|
1179
1199
|
|
|
1180
|
-
function
|
|
1200
|
+
function u(A, e) {
|
|
1181
1201
|
return Math.abs(A) * Math.sign(e);
|
|
1182
1202
|
}
|
|
1183
1203
|
|
|
1184
|
-
function
|
|
1185
|
-
const t = A.getCoordinates(), i = e.coordinateToPointAtRes(t, e.getGLRes()),
|
|
1186
|
-
s.add(
|
|
1204
|
+
function b(A, e) {
|
|
1205
|
+
const t = A.getCoordinates(), i = e.coordinateToPointAtRes(t, e.getGLRes()), I = [ i.x, i.y, 0 ], o = m(e, A.getTranslation());
|
|
1206
|
+
s.add(I, I, o);
|
|
1187
1207
|
const g = function(A, e, t, s) {
|
|
1188
1208
|
return A._pointAtResToContainerPoint(e, t, s);
|
|
1189
|
-
}(e, new
|
|
1209
|
+
}(e, new n.Point(I[0], I[1]), e.getGLRes());
|
|
1190
1210
|
g.x += 85;
|
|
1191
1211
|
const r = function(A, e, t, s) {
|
|
1192
1212
|
{
|
|
@@ -1194,16 +1214,16 @@ function P(A, e) {
|
|
|
1194
1214
|
return A.coordinateToPointAtRes(s, t);
|
|
1195
1215
|
}
|
|
1196
1216
|
}(e, g, e.getGLRes());
|
|
1197
|
-
return Math.sqrt(Math.pow(r.x -
|
|
1217
|
+
return Math.sqrt(Math.pow(r.x - I[0], 2) + Math.pow(r.y - I[1], 2)) / 5.272881136101205;
|
|
1198
1218
|
}
|
|
1199
1219
|
|
|
1200
|
-
function
|
|
1220
|
+
function m(A, e) {
|
|
1201
1221
|
if (!A) return e;
|
|
1202
1222
|
const t = A.distanceToPointAtRes(e[0], e[1], A.getGLRes()), i = A.altitudeToPoint(e[2], A.getGLRes());
|
|
1203
|
-
return s.set([],
|
|
1223
|
+
return s.set([], u(t.x, e[0]), u(t.y, e[1]), u(i, e[2]));
|
|
1204
1224
|
}
|
|
1205
1225
|
|
|
1206
|
-
class
|
|
1226
|
+
class B {
|
|
1207
1227
|
constructor(A) {
|
|
1208
1228
|
this.A = A, this._meshes = this.t();
|
|
1209
1229
|
}
|
|
@@ -1211,7 +1231,7 @@ class u {
|
|
|
1211
1231
|
this.A = A;
|
|
1212
1232
|
}
|
|
1213
1233
|
t() {
|
|
1214
|
-
const A = [], e = 340 / 177, t =
|
|
1234
|
+
const A = [], e = 340 / 177, t = D("jiantou", [ 1.2 * e, 0, 0 ], [ 0, 0, 90 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 7), s = D("jiantou", [ 0, 1.2 * e, 0 ], [ 0, 0, 180 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 8), i = D("jiantou", [ -1.2 * e, 0, 0 ], [ 0, 0, 270 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 9), n = D("jiantou", [ 0, -1.2 * e, 0 ], [ 0, 0, 0 ], [ e, e, e ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 10);
|
|
1215
1235
|
return A.push(t, s, i, n), A;
|
|
1216
1236
|
}
|
|
1217
1237
|
getMeshes() {
|
|
@@ -1219,7 +1239,7 @@ class u {
|
|
|
1219
1239
|
}
|
|
1220
1240
|
}
|
|
1221
1241
|
|
|
1222
|
-
class
|
|
1242
|
+
class y {
|
|
1223
1243
|
constructor(A) {
|
|
1224
1244
|
this.A = A, this._meshes = this.t();
|
|
1225
1245
|
}
|
|
@@ -1227,7 +1247,7 @@ class m {
|
|
|
1227
1247
|
this.A = A;
|
|
1228
1248
|
}
|
|
1229
1249
|
t() {
|
|
1230
|
-
const A = [], e = 340 / 177, t =
|
|
1250
|
+
const A = [], e = 340 / 177, t = D("xuanzhuan", [ 0, 0, 0 ], [ 180, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 50 / 255, 130 / 255, 184 / 255, .8 ], 11);
|
|
1231
1251
|
return A.push(t), A;
|
|
1232
1252
|
}
|
|
1233
1253
|
getMeshes() {
|
|
@@ -1235,7 +1255,7 @@ class m {
|
|
|
1235
1255
|
}
|
|
1236
1256
|
}
|
|
1237
1257
|
|
|
1238
|
-
class
|
|
1258
|
+
class p {
|
|
1239
1259
|
constructor(A) {
|
|
1240
1260
|
this.A = A, this._meshes = this.t();
|
|
1241
1261
|
}
|
|
@@ -1243,7 +1263,7 @@ class b {
|
|
|
1243
1263
|
this.A = A;
|
|
1244
1264
|
}
|
|
1245
1265
|
t() {
|
|
1246
|
-
const A = [], e = 340 / 177, t =
|
|
1266
|
+
const A = [], e = 340 / 177, t = D("yuanhuan", [ 0, 0, 0 ], [ 0, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 149 / 255, 179 / 255, 199 / 255, .5 ], 12);
|
|
1247
1267
|
return A.push(t), A;
|
|
1248
1268
|
}
|
|
1249
1269
|
getMeshes() {
|
|
@@ -1251,7 +1271,7 @@ class b {
|
|
|
1251
1271
|
}
|
|
1252
1272
|
}
|
|
1253
1273
|
|
|
1254
|
-
class
|
|
1274
|
+
class v {
|
|
1255
1275
|
constructor(A) {
|
|
1256
1276
|
this.A = A, this._meshes = this.t();
|
|
1257
1277
|
}
|
|
@@ -1259,7 +1279,7 @@ class B {
|
|
|
1259
1279
|
this.A = A;
|
|
1260
1280
|
}
|
|
1261
1281
|
t() {
|
|
1262
|
-
const A = [], e =
|
|
1282
|
+
const A = [], e = D("plane", [ 0, 0, 0 ], [ 0, 0, 0 ], [ 10, 10, 10 ], [ 1, 0, 0, .5 ], 16);
|
|
1263
1283
|
return A.push(e), A;
|
|
1264
1284
|
}
|
|
1265
1285
|
getMeshes() {
|
|
@@ -1267,7 +1287,7 @@ class B {
|
|
|
1267
1287
|
}
|
|
1268
1288
|
}
|
|
1269
1289
|
|
|
1270
|
-
class
|
|
1290
|
+
class d {
|
|
1271
1291
|
constructor(A) {
|
|
1272
1292
|
this.A = A, this._meshes = this.t();
|
|
1273
1293
|
}
|
|
@@ -1275,7 +1295,7 @@ class y {
|
|
|
1275
1295
|
this.A = A;
|
|
1276
1296
|
}
|
|
1277
1297
|
t() {
|
|
1278
|
-
const A = [], e =
|
|
1298
|
+
const A = [], e = D("xyzScale", [ 0, 0, 0 ], [ 0, 0, 0 ], [ 2, 2, 2 ], null, 113);
|
|
1279
1299
|
return A.push(e), A;
|
|
1280
1300
|
}
|
|
1281
1301
|
getMeshes() {
|
|
@@ -1283,45 +1303,45 @@ class y {
|
|
|
1283
1303
|
}
|
|
1284
1304
|
}
|
|
1285
1305
|
|
|
1286
|
-
const
|
|
1306
|
+
const L = [], M = [], E = [], O = [], F = [], x = [ 177 / 170, 177 / 170, 177 / 170 ], U = [], V = [ 1, 2, 3, 4, 12 ];
|
|
1287
1307
|
|
|
1288
|
-
class
|
|
1308
|
+
class S {
|
|
1289
1309
|
constructor() {
|
|
1290
|
-
this.translate = new
|
|
1291
|
-
this.xyzScaleHelper = new
|
|
1310
|
+
this.translate = new B, this.rotation = new y, this.scaling = new p, this.planeHelper = new v,
|
|
1311
|
+
this.xyzScaleHelper = new d, this._meshes = this.t(), this.i = !0;
|
|
1292
1312
|
}
|
|
1293
1313
|
t() {
|
|
1294
1314
|
const A = {};
|
|
1295
1315
|
A.translate = this.translate.getMeshes(), A.rotation = this.rotation.getMeshes(),
|
|
1296
1316
|
A.scaling = this.scaling.getMeshes(), A.planeHelper = this.planeHelper.getMeshes(),
|
|
1297
1317
|
A.xyzScale = this.xyzScaleHelper.getMeshes();
|
|
1298
|
-
const e = 340 / 177, t =
|
|
1318
|
+
const e = 340 / 177, t = D("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 = D("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 = D("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 = D("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 = D("yuanpan", [ 0, 0, 0 ], [ 90, 0, 0 ], [ .5 * e, .5 * e, .5 * e ], [ 89 / 255, 206 / 255, 147 / 255, .5 ], 5), o = D("zzhou", [ 0, 0, 6.5 ], [ 90, 0, 0 ], [ 1, 1, 1 ], [ 14 / 255, 127 / 255, 191 / 255, 1 ], 6);
|
|
1299
1319
|
return A.translate.push(t, s, i, n, I, o), A;
|
|
1300
1320
|
}
|
|
1301
1321
|
updateMatrix(t, i, n, I, o) {
|
|
1302
1322
|
const g = i.getCoordinates(), r = t.coordinateToPointAtRes(g, t.getGLRes()), a = i.I();
|
|
1303
|
-
s.set(
|
|
1304
|
-
const C = s.copy(
|
|
1305
|
-
s.add(
|
|
1323
|
+
s.set(M, r.x, r.y, a);
|
|
1324
|
+
const C = s.copy(L, o), h = m(t, i.getTranslation());
|
|
1325
|
+
s.add(M, M, h), s.add(M, M, C);
|
|
1306
1326
|
for (const o in this._meshes) for (let g = 0; g < this._meshes[o].length; g++) {
|
|
1307
1327
|
const r = this._meshes[o][g];
|
|
1308
1328
|
for (let g = 0; g < r.length; g++) {
|
|
1309
|
-
const a = r[g], C = a.getUniform("uPickingId"), h = s.copy(
|
|
1310
|
-
let w = s.copy(
|
|
1329
|
+
const a = r[g], C = a.getUniform("uPickingId"), h = s.copy(L, a.translate);
|
|
1330
|
+
let w = s.copy(U, a.rotation);
|
|
1311
1331
|
const c = a.scaling;
|
|
1312
1332
|
if (11 === C && (this.i ? (w[2] += n, a.rotation[2] += n) : this.i || (w[2] += n,
|
|
1313
1333
|
a.rotation[2] += n, w[0] = 360, w[2] -= 90)), C > 100 && 1 === i.getTargets().length && (w = i.getTargets()[0].getRotation()),
|
|
1314
|
-
|
|
1334
|
+
V.indexOf(C) > -1) if (12 !== C) c[0] += I, c[1] += I, c[2] += I; else {
|
|
1315
1335
|
const A = this._meshes.translate[4][0];
|
|
1316
1336
|
c[0] = 1.2 * A.scaling[0], c[1] = 1.2 * A.scaling[0], c[2] = 1.2 * A.scaling[0];
|
|
1317
1337
|
}
|
|
1318
|
-
let Q =
|
|
1319
|
-
if (Q = s.set(
|
|
1320
|
-
const A = s.multiply(
|
|
1338
|
+
let Q = b(i, t);
|
|
1339
|
+
if (Q = s.set(E, Q, Q, Q), s.multiply(h, h, Q), s.multiply(Q, Q, c), 1 === C || 2 === C || 3 === C || 4 === C) {
|
|
1340
|
+
const A = s.multiply(F, c, x);
|
|
1321
1341
|
s.multiply(h, h, A);
|
|
1322
1342
|
}
|
|
1323
|
-
const f = A.fromEuler(
|
|
1324
|
-
if (s.add(h, h,
|
|
1343
|
+
const f = A.fromEuler(O, w[0], w[1], w[2]);
|
|
1344
|
+
if (s.add(h, h, M), "xyzScale" === o) {
|
|
1325
1345
|
const A = e.fromRotationTranslationScale([], f, h, Q);
|
|
1326
1346
|
e.multiply(a.localTransform, A, a.originTransform);
|
|
1327
1347
|
} else e.fromRotationTranslationScale(a.localTransform, f, h, Q);
|
|
@@ -1347,9 +1367,9 @@ class x {
|
|
|
1347
1367
|
}
|
|
1348
1368
|
}
|
|
1349
1369
|
|
|
1350
|
-
const
|
|
1370
|
+
const k = [], T = [], _ = [], H = new I(0, 0), J = [], N = [], R = [], K = [ 0, 0, 0 ];
|
|
1351
1371
|
|
|
1352
|
-
class
|
|
1372
|
+
class z {
|
|
1353
1373
|
constructor() {
|
|
1354
1374
|
this.C = [], this.h = [ 0, 0, 0 ], this.l = [ 1, 1, 1 ], this.P = [ 0, 0, 0 ];
|
|
1355
1375
|
}
|
|
@@ -1373,7 +1393,7 @@ class R {
|
|
|
1373
1393
|
const g = this.C[o], r = g.getRotation(), a = g.getScale(), C = this.v(I, g, i, t, e);
|
|
1374
1394
|
let h = null;
|
|
1375
1395
|
h = i >= 0 ? i : i * (this.options && this.options.scaleStrength || 1);
|
|
1376
|
-
const w = s.add(
|
|
1396
|
+
const w = s.add(R, s.set(k, h * a[0], h * a[1], h * a[2]), a), c = Math.min(...w);
|
|
1377
1397
|
if (Math.abs(c) < n) {
|
|
1378
1398
|
const A = Math.abs(c);
|
|
1379
1399
|
w[0] = w[0] * (n / A), w[1] = w[1] * (n / A), w[2] = w[2] * (n / A);
|
|
@@ -1383,7 +1403,7 @@ class R {
|
|
|
1383
1403
|
const f = g.getTranslation();
|
|
1384
1404
|
g.setTRS(f, Q, w);
|
|
1385
1405
|
}
|
|
1386
|
-
s.set(
|
|
1406
|
+
s.set(R, i, i, i), s.add(this.P, t, this.P), s.add(this.l, R, this.l), s.add(this.h, e, this.h),
|
|
1387
1407
|
A.indexOf("translate") > -1 ? o.fire("positionchange", {
|
|
1388
1408
|
action: A,
|
|
1389
1409
|
type: "positionchange",
|
|
@@ -1409,15 +1429,15 @@ class R {
|
|
|
1409
1429
|
});
|
|
1410
1430
|
}
|
|
1411
1431
|
v(t, i, n, I, o) {
|
|
1412
|
-
const g = i.getCenter(), r = i.getTransformOrigin(), a = t.getGLRes(), C = t.coordinateToPointAtRes(g, a,
|
|
1413
|
-
C.z = t.altitudeToPoint(g.z, a), s.set(
|
|
1414
|
-
const h = t.coordinateToPointAtRes(r, a,
|
|
1415
|
-
h.z = t.altitudeToPoint(r.z, a), s.set(
|
|
1416
|
-
const w = s.sub(
|
|
1417
|
-
s.set(
|
|
1418
|
-
const Q = e.fromRotationTranslationScale(
|
|
1419
|
-
s.transformMat4(w, w, Q), s.add(w, w,
|
|
1420
|
-
const f = t.pointAtResToCoordinate(
|
|
1432
|
+
const g = i.getCenter(), r = i.getTransformOrigin(), a = t.getGLRes(), C = t.coordinateToPointAtRes(g, a, H);
|
|
1433
|
+
C.z = t.altitudeToPoint(g.z, a), s.set(J, C.x, C.y, C.z || 0);
|
|
1434
|
+
const h = t.coordinateToPointAtRes(r, a, H);
|
|
1435
|
+
h.z = t.altitudeToPoint(r.z, a), s.set(N, h.x, h.y, h.z || 0);
|
|
1436
|
+
const w = s.sub(k, J, N), c = A.fromEuler(T, 0, 0, I[2]);
|
|
1437
|
+
s.set(R, n + 1, n + 1, n + 1);
|
|
1438
|
+
const Q = e.fromRotationTranslationScale(_, c, o, R);
|
|
1439
|
+
s.transformMat4(w, w, Q), s.add(w, w, N), H.set(w[0], w[1]);
|
|
1440
|
+
const f = t.pointAtResToCoordinate(H, a);
|
|
1421
1441
|
return f.z = w[2] / t.altitudeToPoint(1, a), f;
|
|
1422
1442
|
}
|
|
1423
1443
|
L(A, e, t) {
|
|
@@ -1436,7 +1456,7 @@ class R {
|
|
|
1436
1456
|
return this.l;
|
|
1437
1457
|
}
|
|
1438
1458
|
getTranslation() {
|
|
1439
|
-
return 1 === this.C.length && this.C[0].getTranslation() ||
|
|
1459
|
+
return 1 === this.C.length && this.C[0].getTranslation() || K;
|
|
1440
1460
|
}
|
|
1441
1461
|
getRotation() {
|
|
1442
1462
|
return this.P;
|
|
@@ -1453,7 +1473,7 @@ class R {
|
|
|
1453
1473
|
A += s.x, e += s.y, t += s.z || 0;
|
|
1454
1474
|
}
|
|
1455
1475
|
A /= s, e /= s, t /= s;
|
|
1456
|
-
const i = new
|
|
1476
|
+
const i = new o(A, e, t);
|
|
1457
1477
|
for (let A = 0; A < s; A++) this.C[A].setTransformOrigin(i);
|
|
1458
1478
|
return i;
|
|
1459
1479
|
}
|
|
@@ -1478,12 +1498,12 @@ class R {
|
|
|
1478
1498
|
}
|
|
1479
1499
|
}
|
|
1480
1500
|
|
|
1481
|
-
const
|
|
1501
|
+
const G = [ 5, 6, 7, 8, 9, 10 ], j = [ 5, 7, 8, 9, 10 ], Z = [ 2, 4, 11 ], Y = [ 1, 3, 12 ], W = [ 12, 16 ], q = [ 1, 2, 3, 4 ], X = [ 1, 2, 3, 4, 12 ], $ = [], AA = [], eA = [], tA = [], sA = [], iA = [], nA = [];
|
|
1482
1502
|
|
|
1483
|
-
class
|
|
1503
|
+
class IA extends(g(r(a))){
|
|
1484
1504
|
constructor(A = {}) {
|
|
1485
1505
|
super(A), this.options = A, this.mouseAction = "moving", this.U = this.options.mode || "translate",
|
|
1486
|
-
this.V = !0, this.TransformHelper = new
|
|
1506
|
+
this.V = !0, this.TransformHelper = new S, this.S = new z, this.helperScene = new t.Scene([]),
|
|
1487
1507
|
this.addToMapCount = 0, this.k();
|
|
1488
1508
|
}
|
|
1489
1509
|
setCoordinates(A) {
|
|
@@ -1497,7 +1517,7 @@ class sA extends(r(a(C))){
|
|
|
1497
1517
|
this;
|
|
1498
1518
|
}
|
|
1499
1519
|
setMode(A) {
|
|
1500
|
-
this.U = A, this.
|
|
1520
|
+
this.U = A, this._(), this.layerRenderer && this.layerRenderer.setToRedraw(), this.fire("modechange", {
|
|
1501
1521
|
mode: A,
|
|
1502
1522
|
type: "modechange"
|
|
1503
1523
|
});
|
|
@@ -1508,20 +1528,20 @@ class sA extends(r(a(C))){
|
|
|
1508
1528
|
isEnable() {
|
|
1509
1529
|
return this.V;
|
|
1510
1530
|
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1531
|
+
H(A) {
|
|
1532
|
+
G.indexOf(A) > -1 ? this.U = "translate" : Z.indexOf(A) > -1 ? this.U = "rotation" : Y.indexOf(A) > -1 ? this.U = "scaling" : "xyzScale" !== this.U && (this.U = "translate");
|
|
1513
1533
|
}
|
|
1514
|
-
|
|
1534
|
+
J() {
|
|
1515
1535
|
return this.U;
|
|
1516
1536
|
}
|
|
1517
1537
|
addTo(A) {
|
|
1518
|
-
if (this.map) return this.
|
|
1519
|
-
this.addToMapCount++, this.map = A, this.
|
|
1538
|
+
if (this.map) return this.N(), void console.warn("transform control has been added to a map, it suggest remove from the map before");
|
|
1539
|
+
this.addToMapCount++, this.map = A, this.R.addTo(this.map), this.container = A.getContainer(),
|
|
1520
1540
|
A.on("dom:mousemove", this.K, this), A.on("dom:mousedown", this.G, this), A.on("dom:mouseup", this.j, this),
|
|
1521
1541
|
A.on("zooming moving dragrotating", this.Z, this), this.Y();
|
|
1522
1542
|
}
|
|
1523
1543
|
k() {
|
|
1524
|
-
this.
|
|
1544
|
+
this.R = new h(`${C}_transformcontrol`), this.T = new w([ 0, 0 ], {
|
|
1525
1545
|
symbol: {
|
|
1526
1546
|
url: "cube",
|
|
1527
1547
|
modelHeight: 1,
|
|
@@ -1529,15 +1549,15 @@ class sA extends(r(a(C))){
|
|
|
1529
1549
|
polygonOpacity: .01
|
|
1530
1550
|
}
|
|
1531
1551
|
}
|
|
1532
|
-
}).addTo(this.
|
|
1552
|
+
}).addTo(this.R);
|
|
1533
1553
|
}
|
|
1534
1554
|
remove() {
|
|
1535
|
-
this.map && this.container && this.layerRenderer && (this.
|
|
1536
|
-
this.layerRenderer.setToRedraw(), this.
|
|
1555
|
+
this.map && this.container && this.layerRenderer && (this.N(), this.TransformHelper.dispose(),
|
|
1556
|
+
this.layerRenderer.setToRedraw(), this.R.remove(), delete this.T, delete this.R,
|
|
1537
1557
|
delete this.map, delete this.layer, delete this.layerRenderer, delete this.container,
|
|
1538
1558
|
delete this.S);
|
|
1539
1559
|
}
|
|
1540
|
-
|
|
1560
|
+
N() {
|
|
1541
1561
|
this.container && this.map && (this.map.off("dom:mousemove", this.K, this), this.map.off("dom:mousedown", this.G, this),
|
|
1542
1562
|
this.map.off("dom:mouseup", this.j, this), this.map.off("zooming moving dragrotating", this.Z, this),
|
|
1543
1563
|
this.layer && this.layer.off("renderend", this.render, this));
|
|
@@ -1549,9 +1569,9 @@ class sA extends(r(a(C))){
|
|
|
1549
1569
|
y: A.containerPoint.y
|
|
1550
1570
|
}, "moving" === this.mouseAction) {
|
|
1551
1571
|
const A = this.q();
|
|
1552
|
-
this.currentPickingObject = this.X(this.currentMousePosition, A, "meshes"), this.currentPickingObject && null != this.currentPickingObject.pickingId ? (this.
|
|
1572
|
+
this.currentPickingObject = this.X(this.currentMousePosition, A, "meshes"), this.currentPickingObject && null != this.currentPickingObject.pickingId ? (this.H(this.currentPickingObject.pickingId),
|
|
1553
1573
|
6 === this.currentPickingObject.pickingId ? this.$(!0) : this.$(!1)) : (this.$(!1),
|
|
1554
|
-
this.
|
|
1574
|
+
this.H()), this.AA();
|
|
1555
1575
|
}
|
|
1556
1576
|
this.eA(this.currentMousePosition);
|
|
1557
1577
|
}
|
|
@@ -1566,11 +1586,11 @@ class sA extends(r(a(C))){
|
|
|
1566
1586
|
this.firstDownPoint = this.X(this.currentMousePosition, e, "meshes"), this.currentPickingObject && null != this.currentPickingObject.meshId ? (this.mouseAction = "transform",
|
|
1567
1587
|
this.sA(this.currentPickingObject.pickingId), this.map.config("zoomable", !1), this.map.config("draggable", !1),
|
|
1568
1588
|
this.layerRenderer && this.layerRenderer.setToRedraw()) : (this.mouseAction = "pan",
|
|
1569
|
-
this.map.config("zoomable", !0), this.map.config("draggable", !0), this.
|
|
1589
|
+
this.map.config("zoomable", !0), this.map.config("draggable", !0), this._()), this.lastMousePosition = this.currentMousePosition,
|
|
1570
1590
|
this.lastPickingObject = this.currentPickingObject, this.lastPickingMesh = e[this.currentPickingObject.meshId];
|
|
1571
1591
|
}
|
|
1572
1592
|
j() {
|
|
1573
|
-
"transform" === this.mouseAction && (this.firstDownPoint = null, this.
|
|
1593
|
+
"transform" === this.mouseAction && (this.firstDownPoint = null, this._(), this.tA = !0,
|
|
1574
1594
|
this.fire("transformend", {
|
|
1575
1595
|
action: this.iA,
|
|
1576
1596
|
type: "transformend"
|
|
@@ -1589,11 +1609,11 @@ class sA extends(r(a(C))){
|
|
|
1589
1609
|
if (!this.layerRenderer) return !1;
|
|
1590
1610
|
const e = this.q(), t = this.map;
|
|
1591
1611
|
let s = A;
|
|
1592
|
-
A instanceof
|
|
1612
|
+
A instanceof I || (s = t.coordinateToContainerPoint(new o(A)));
|
|
1593
1613
|
const i = this.X(s, e, "picked");
|
|
1594
1614
|
return !(!i || null === i.meshId);
|
|
1595
1615
|
}
|
|
1596
|
-
|
|
1616
|
+
_() {
|
|
1597
1617
|
const A = this.TransformHelper.getMeshes("scaling").scaling[0][0], e = 340 / 177;
|
|
1598
1618
|
A.scaling = [ .6 * e, .6 * e, .6 * e ], this.layerRenderer && (this.IA(A), this.oA());
|
|
1599
1619
|
}
|
|
@@ -1601,15 +1621,15 @@ class sA extends(r(a(C))){
|
|
|
1601
1621
|
this.TransformHelper._meshes.translate.forEach((A => {
|
|
1602
1622
|
for (let e = 0; e < A.length; e++) {
|
|
1603
1623
|
const t = A[e];
|
|
1604
|
-
|
|
1624
|
+
q.indexOf(t.getUniform("uPickingId")) > -1 && t.material.set("color", t.originColor);
|
|
1605
1625
|
}
|
|
1606
1626
|
}));
|
|
1607
1627
|
}
|
|
1608
1628
|
IA(t) {
|
|
1609
|
-
const i = this.S.getCoordinates(), n = this.map.coordinateToPointAtRes(i, this.map.getGLRes()), I = [ n.x, n.y, 0 ], o =
|
|
1629
|
+
const i = this.S.getCoordinates(), n = this.map.coordinateToPointAtRes(i, this.map.getGLRes()), I = [ n.x, n.y, 0 ], o = m(this.map, this.S.getTranslation());
|
|
1610
1630
|
s.add(I, I, o);
|
|
1611
1631
|
const g = s.copy([], t.translate), r = t.scaling;
|
|
1612
|
-
let a =
|
|
1632
|
+
let a = b(this.S, this.map);
|
|
1613
1633
|
a = s.set([], a, a, a), s.multiply(g, g, a), s.multiply(a, a, r), s.add(g, g, I),
|
|
1614
1634
|
e.fromRotationTranslationScale(t.localTransform, [ 0, 0, 0, 1 ], g, a);
|
|
1615
1635
|
this.q().forEach((t => {
|
|
@@ -1618,7 +1638,7 @@ class sA extends(r(a(C))){
|
|
|
1618
1638
|
const i = s.copy([], t.translate), n = 170 / 177;
|
|
1619
1639
|
t.scaling = [ n, n, n ];
|
|
1620
1640
|
const o = t.scaling, g = t.rotation;
|
|
1621
|
-
let r =
|
|
1641
|
+
let r = b(this.S, this.map);
|
|
1622
1642
|
r = s.set([], r, r, r), s.multiply(i, i, r), s.multiply(r, r, o), s.add(i, i, I);
|
|
1623
1643
|
const a = A.fromEuler([], g[0], g[1], g[2]);
|
|
1624
1644
|
e.fromRotationTranslationScale(t.localTransform, a, i, r);
|
|
@@ -1633,58 +1653,58 @@ class sA extends(r(a(C))){
|
|
|
1633
1653
|
}
|
|
1634
1654
|
eA(A) {
|
|
1635
1655
|
if ("transform" === this.mouseAction) {
|
|
1636
|
-
const A = this.
|
|
1637
|
-
let s = null,
|
|
1656
|
+
const A = this.J(), e = m(this.map, this.S.getTranslation()), t = this.S.I();
|
|
1657
|
+
let s = null, n = null;
|
|
1638
1658
|
if (e[2] + t < .01 && "z-translate" !== this.iA) s = this.gA(this.currentMousePosition),
|
|
1639
|
-
|
|
1659
|
+
n = this.gA(this.lastMousePosition); else {
|
|
1640
1660
|
const A = this.TransformHelper.planeHelper.getMeshes()[0];
|
|
1641
|
-
if (s = this.X(this.currentMousePosition, A, "plane"),
|
|
1642
|
-
!s || null === s.meshId || !
|
|
1661
|
+
if (s = this.X(this.currentMousePosition, A, "plane"), n = this.X(this.lastMousePosition, A, "plane"),
|
|
1662
|
+
!s || null === s.meshId || !n || null === n.meshId) return;
|
|
1643
1663
|
}
|
|
1644
|
-
const
|
|
1664
|
+
const o = [ 0, 0, 0 ], g = [ 0, 0, 0 ];
|
|
1645
1665
|
let r = 0, a = 0, C = 0;
|
|
1646
1666
|
if ("translate" === A) {
|
|
1647
1667
|
if ("xy-translate" === this.iA) {
|
|
1648
|
-
const A = s.point[0] -
|
|
1649
|
-
|
|
1668
|
+
const A = s.point[0] - n.point[0], e = s.point[1] - n.point[1];
|
|
1669
|
+
o[0] = A, o[1] = e;
|
|
1650
1670
|
} else if ("x-translate" === this.iA) {
|
|
1651
|
-
const A = s.point[0] -
|
|
1652
|
-
|
|
1671
|
+
const A = s.point[0] - n.point[0];
|
|
1672
|
+
o[0] = A;
|
|
1653
1673
|
} else if ("y-translate" === this.iA) {
|
|
1654
|
-
const A = s.point[1] -
|
|
1655
|
-
|
|
1674
|
+
const A = s.point[1] - n.point[1];
|
|
1675
|
+
o[1] = A;
|
|
1656
1676
|
} else if ("z-translate" === this.iA) {
|
|
1657
1677
|
let A = 0;
|
|
1658
1678
|
if (this.rA()) {
|
|
1659
|
-
const e = this.map.getGLRes(), t = this.map._pointAtResToContainerPoint(new
|
|
1660
|
-
A =
|
|
1661
|
-
} else A = s.point[2] -
|
|
1662
|
-
|
|
1679
|
+
const e = this.map.getGLRes(), t = this.map._pointAtResToContainerPoint(new I(n.point[0], n.point[1]), e), o = this.map._pointAtResToContainerPoint(new I(s.point[0], s.point[1]), e), g = i.length(i.set(tA, s.point[0] - n.point[0], s.point[1] - n.point[1]));
|
|
1680
|
+
A = o.y < t.y ? g : -g;
|
|
1681
|
+
} else A = s.point[2] - n.point[2];
|
|
1682
|
+
o[2] = A;
|
|
1663
1683
|
}
|
|
1664
|
-
} else if ("rotation" === A) a = this.aA(s.point,
|
|
1684
|
+
} else if ("rotation" === A) a = this.aA(s.point, n.point), a >= 0 ? this.TransformHelper.o(!0) : this.TransformHelper.o(!1),
|
|
1665
1685
|
g[2] += a; else if ("scaling" === A || "xyzScale" === A) {
|
|
1666
|
-
const A = this.CA(), e =
|
|
1667
|
-
r = this.hA(s.point,
|
|
1686
|
+
const A = this.CA(), e = i.length(i.set(tA, this.firstDownPoint.point[0] - A[0], this.firstDownPoint.point[1] - A[1])), t = i.length(i.set(tA, n.point[0] - A[0], n.point[1] - A[1]));
|
|
1687
|
+
r = this.hA(s.point, n.point, A, t), C = this.hA(s.point, n.point, A, e);
|
|
1668
1688
|
}
|
|
1669
|
-
this.TransformHelper.updateMatrix(this.map, this.S, a, C,
|
|
1689
|
+
this.TransformHelper.updateMatrix(this.map, this.S, a, C, o), this.S.p(this.iA, o, g, r, .01, this.map, this);
|
|
1670
1690
|
}
|
|
1671
1691
|
this.lastMousePosition = A, this.lastPickingObject = this.currentPickingObject;
|
|
1672
1692
|
const e = this.q();
|
|
1673
1693
|
this.lastPickingMesh = e[this.currentPickingObject.meshId];
|
|
1674
1694
|
}
|
|
1675
|
-
hA(A, e, t, s,
|
|
1676
|
-
const I = (
|
|
1677
|
-
return
|
|
1695
|
+
hA(A, e, t, s, n) {
|
|
1696
|
+
const I = (i.length(i.set(tA, A[0] - t[0], A[1] - t[1])) - i.length(i.set(tA, e[0] - t[0], e[1] - t[1]))) / s;
|
|
1697
|
+
return n ? (n[0] - .01) * I : I;
|
|
1678
1698
|
}
|
|
1679
1699
|
CA() {
|
|
1680
|
-
const A = this.map, e = this.S.getCoordinates(), t = A.coordinateToPointAtRes(e, A.getGLRes()), i = s.set(
|
|
1700
|
+
const A = this.map, e = this.S.getCoordinates(), t = A.coordinateToPointAtRes(e, A.getGLRes()), i = s.set(sA, t.x, t.y, 0), n = m(A, this.S.getTranslation());
|
|
1681
1701
|
return s.add(i, i, n), i;
|
|
1682
1702
|
}
|
|
1683
1703
|
$(t) {
|
|
1684
|
-
const i = this.TransformHelper.planeHelper.getMeshes()[0][0], n = e.getTranslation(
|
|
1685
|
-
let o = A.fromEuler(
|
|
1704
|
+
const i = this.TransformHelper.planeHelper.getMeshes()[0][0], n = e.getTranslation(eA, i.localTransform), I = e.getScaling(AA, i.localTransform);
|
|
1705
|
+
let o = A.fromEuler($, 0, 0, 0);
|
|
1686
1706
|
const g = this.map.getBearing();
|
|
1687
|
-
t && !this.rA() ? (o = A.fromEuler(
|
|
1707
|
+
t && !this.rA() ? (o = A.fromEuler($, 90, 0, -g), 0 === i.rotation[0] && (this.tA = !0),
|
|
1688
1708
|
s.set(i.rotation, 90, 0, -g)) : (90 === i.rotation[0] && (this.tA = !0), s.set(i.rotation, 0, 0, -g)),
|
|
1689
1709
|
e.fromRotationTranslationScale(i.localTransform, o, n, I);
|
|
1690
1710
|
}
|
|
@@ -1692,7 +1712,7 @@ class sA extends(r(a(C))){
|
|
|
1692
1712
|
if (this.map.getPitch()) return !1;
|
|
1693
1713
|
const A = this.map.cameraPosition, e = this.map.coordinateToPointAtRes(this.map.getCenter(), this.map.getGLRes());
|
|
1694
1714
|
s.set(e, e.x, e.y, 0);
|
|
1695
|
-
const t = this.S.getCoordinates(), i = this.map.coordinateToPointAtRes(t, this.map.getGLRes()), n =
|
|
1715
|
+
const t = this.S.getCoordinates(), i = this.map.coordinateToPointAtRes(t, this.map.getGLRes()), n = m(this.map, this.S.getTranslation()), I = s.set(eA, i.x, i.y, 0), o = s.add(I, I, n), g = s.subtract([], A, o), r = s.subtract([], A, e);
|
|
1696
1716
|
return s.angle(g, r) < 1 / 180 * Math.PI;
|
|
1697
1717
|
}
|
|
1698
1718
|
AA() {
|
|
@@ -1700,7 +1720,7 @@ class sA extends(r(a(C))){
|
|
|
1700
1720
|
if (this.currentPickingObject && null != this.currentPickingObject.meshId) {
|
|
1701
1721
|
this.wA(), this.lastPickingObject && null != this.lastPickingObject.meshId && this.lastPickingObject.meshId !== this.currentPickingObject.meshId && this.cA();
|
|
1702
1722
|
const e = A[this.currentPickingObject.meshId];
|
|
1703
|
-
if (e &&
|
|
1723
|
+
if (e && W.indexOf(this.currentPickingObject.pickingId) < 0) if (this.currentPickingObject.pickingId > 100) this.QA(e); else {
|
|
1704
1724
|
const A = [ e.originColor[0], e.originColor[1], e.originColor[2], .8 ];
|
|
1705
1725
|
e.material.set("color", A), this.fA(e, .5);
|
|
1706
1726
|
}
|
|
@@ -1715,27 +1735,27 @@ class sA extends(r(a(C))){
|
|
|
1715
1735
|
}));
|
|
1716
1736
|
}
|
|
1717
1737
|
wA() {
|
|
1718
|
-
6 === this.currentPickingObject.pickingId ? this.map.setCursor("ns-resize") :
|
|
1738
|
+
6 === this.currentPickingObject.pickingId ? this.map.setCursor("ns-resize") : j.indexOf(this.currentPickingObject.pickingId) > -1 ? this.map.setCursor("move") : this.map.setCursor("pointer");
|
|
1719
1739
|
}
|
|
1720
1740
|
cA() {
|
|
1721
1741
|
const A = this.lastPickingMesh;
|
|
1722
1742
|
if (!A) return;
|
|
1723
1743
|
const e = A.getUniform("uPickingId"), t = this.q();
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
})) :
|
|
1744
|
+
j.indexOf(e) > -1 ? t.forEach((A => {
|
|
1745
|
+
j.indexOf(A.getUniform("uPickingId")) > -1 && A.material.set("color", A.originColor);
|
|
1746
|
+
})) : X.indexOf(e) > -1 ? t.forEach((A => {
|
|
1727
1747
|
const e = A.getUniform("uPickingId");
|
|
1728
|
-
|
|
1748
|
+
q.indexOf(e) > -1 && A.material.set("color", A.originColor);
|
|
1729
1749
|
})) : 11 === e && t.forEach((A => {
|
|
1730
|
-
|
|
1750
|
+
q.indexOf(A.getUniform("uPickingId")) > -1 && A.material.set("color", A.originColor);
|
|
1731
1751
|
})), A.material.set("color", A.originColor), A.properties.relatedMeshes && A.properties.relatedMeshes.forEach((A => {
|
|
1732
1752
|
A.material.set("color", A.originColor);
|
|
1733
1753
|
}));
|
|
1734
1754
|
}
|
|
1735
1755
|
fA(A, e) {
|
|
1736
1756
|
const t = A.getUniform("uPickingId"), s = this.q();
|
|
1737
|
-
|
|
1738
|
-
if (
|
|
1757
|
+
j.indexOf(t) > -1 ? s.forEach((t => {
|
|
1758
|
+
if (j.indexOf(t.getUniform("uPickingId")) > -1 && t.getUniform("uPickingId") !== A.getUniform("uPickingId")) {
|
|
1739
1759
|
const A = [ t.originColor[0], t.originColor[1], t.originColor[2], e ];
|
|
1740
1760
|
t.material.set("color", A);
|
|
1741
1761
|
}
|
|
@@ -1757,8 +1777,8 @@ class sA extends(r(a(C))){
|
|
|
1757
1777
|
this.map && this.S && (this.S.M(), this.TransformHelper.updateMatrix(this.map, this.S, 0, 0, [ 0, 0, 0 ]));
|
|
1758
1778
|
}
|
|
1759
1779
|
aA(A, e) {
|
|
1760
|
-
const t = this.CA(), s =
|
|
1761
|
-
return (Math.atan2(
|
|
1780
|
+
const t = this.CA(), s = i.set(iA, e[0] - t[0], e[1] - t[1]), n = i.set(nA, A[0] - t[0], A[1] - t[1]), I = Math.atan2(s[1], s[0]);
|
|
1781
|
+
return (Math.atan2(n[1], n[0]) - I) / Math.PI * 180;
|
|
1762
1782
|
}
|
|
1763
1783
|
sA(A) {
|
|
1764
1784
|
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",
|
|
@@ -1797,7 +1817,7 @@ class sA extends(r(a(C))){
|
|
|
1797
1817
|
const s = this.map;
|
|
1798
1818
|
if (!(s && this.DA && this.layerRenderer && this.layerRenderer.canvas)) return null;
|
|
1799
1819
|
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.
|
|
1820
|
+
(this.tA || g || !this.bA || this.bA !== t) && (this.DA.render(e, o, !0), this.bA = t,
|
|
1801
1821
|
this.tA = !1);
|
|
1802
1822
|
return this.DA.pick(n, I, 10, o, {
|
|
1803
1823
|
viewMatrix: this.map.viewMatrix,
|
|
@@ -1812,7 +1832,7 @@ class sA extends(r(a(C))){
|
|
|
1812
1832
|
width: () => this.map ? this.map.width * A : 1,
|
|
1813
1833
|
height: () => this.map ? this.map.height * A : 1
|
|
1814
1834
|
};
|
|
1815
|
-
this.
|
|
1835
|
+
this.mA = new t.MeshShader({
|
|
1816
1836
|
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",
|
|
1817
1837
|
frag: "precision mediump float;\n\nuniform vec4 color;\n\n\n\nvoid main() {\n\n gl_FragColor = color;\n\n}\n\n",
|
|
1818
1838
|
uniforms: [ "color", {
|
|
@@ -1848,9 +1868,9 @@ class sA extends(r(a(C))){
|
|
|
1848
1868
|
this.helperScene.setMeshes(A);
|
|
1849
1869
|
const e = this.layerRenderer.getFrameContext();
|
|
1850
1870
|
if (e && e.renderTarget && this.layerRenderer.getFrameTimestamp() !== e.timestamp) return;
|
|
1851
|
-
this.nA(), this.
|
|
1871
|
+
this.nA(), this.mA.filter = e && e.sceneFilter;
|
|
1852
1872
|
const t = e && e.renderTarget && e.renderTarget.fbo;
|
|
1853
|
-
this.renderer.render(this.
|
|
1873
|
+
this.renderer.render(this.mA, this.uA, this.helperScene, t);
|
|
1854
1874
|
}
|
|
1855
1875
|
q() {
|
|
1856
1876
|
let A = [];
|
|
@@ -1870,11 +1890,11 @@ class sA extends(r(a(C))){
|
|
|
1870
1890
|
}
|
|
1871
1891
|
}
|
|
1872
1892
|
|
|
1873
|
-
|
|
1893
|
+
IA.mergeOptions({
|
|
1874
1894
|
scaleStrength: 2
|
|
1875
1895
|
});
|
|
1876
1896
|
|
|
1877
|
-
export {
|
|
1897
|
+
export { IA as TransformControl };
|
|
1878
1898
|
|
|
1879
|
-
"undefined" != typeof console && console.log("@maptalks/transform-control v0.
|
|
1899
|
+
"undefined" != typeof console && console.log("@maptalks/transform-control v0.103.0");
|
|
1880
1900
|
//# sourceMappingURL=transform-control.es.js.map
|