@maptalks/transform-control 0.105.2 → 0.105.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/transform-control v0.105.
|
|
2
|
+
* @maptalks/transform-control v0.105.4
|
|
3
3
|
* LICENSE : UNLICENSED
|
|
4
4
|
* (c) 2016-2025 maptalks.org
|
|
5
5
|
*/
|
|
@@ -1201,8 +1201,8 @@ function u(A, e) {
|
|
|
1201
1201
|
return Math.abs(A) * Math.sign(e);
|
|
1202
1202
|
}
|
|
1203
1203
|
|
|
1204
|
-
function
|
|
1205
|
-
const t = A.getCoordinates(), i = e.coordinateToPointAtRes(t, e.getGLRes()), I = [ i.x, i.y, 0 ], o =
|
|
1204
|
+
function m(A, e) {
|
|
1205
|
+
const t = A.getCoordinates(), i = e.coordinateToPointAtRes(t, e.getGLRes()), I = [ i.x, i.y, 0 ], o = b(e, A.getTranslation());
|
|
1206
1206
|
s.add(I, I, o);
|
|
1207
1207
|
const g = function(A, e, t, s) {
|
|
1208
1208
|
return A._pointAtResToContainerPoint(e, t, s);
|
|
@@ -1217,7 +1217,7 @@ function b(A, e) {
|
|
|
1217
1217
|
return Math.sqrt(Math.pow(r.x - I[0], 2) + Math.pow(r.y - I[1], 2)) / 5.272881136101205;
|
|
1218
1218
|
}
|
|
1219
1219
|
|
|
1220
|
-
function
|
|
1220
|
+
function b(A, e) {
|
|
1221
1221
|
if (!A) return e;
|
|
1222
1222
|
const t = A.distanceToPointAtRes(e[0], e[1], A.getGLRes()), i = A.altitudeToPoint(e[2], A.getGLRes());
|
|
1223
1223
|
return s.set([], u(t.x, e[0]), u(t.y, e[1]), u(i, e[2]));
|
|
@@ -1321,7 +1321,7 @@ class S {
|
|
|
1321
1321
|
updateMatrix(t, i, n, I, o) {
|
|
1322
1322
|
const g = i.getCoordinates(), r = t.coordinateToPointAtRes(g, t.getGLRes()), a = i.I();
|
|
1323
1323
|
s.set(M, r.x, r.y, a);
|
|
1324
|
-
const C = s.copy(L, o), h =
|
|
1324
|
+
const C = s.copy(L, o), h = b(t, i.getTranslation());
|
|
1325
1325
|
s.add(M, M, h), s.add(M, M, C);
|
|
1326
1326
|
for (const o in this._meshes) for (let g = 0; g < this._meshes[o].length; g++) {
|
|
1327
1327
|
const r = this._meshes[o][g];
|
|
@@ -1335,7 +1335,7 @@ class S {
|
|
|
1335
1335
|
const A = this._meshes.translate[4][0];
|
|
1336
1336
|
c[0] = 1.2 * A.scaling[0], c[1] = 1.2 * A.scaling[0], c[2] = 1.2 * A.scaling[0];
|
|
1337
1337
|
}
|
|
1338
|
-
let Q =
|
|
1338
|
+
let Q = m(i, t);
|
|
1339
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
1340
|
const A = s.multiply(F, c, x);
|
|
1341
1341
|
s.multiply(h, h, A);
|
|
@@ -1407,7 +1407,7 @@ class z {
|
|
|
1407
1407
|
A.indexOf("translate") > -1 ? o.fire("positionchange", {
|
|
1408
1408
|
action: A,
|
|
1409
1409
|
type: "positionchange",
|
|
1410
|
-
|
|
1410
|
+
transformtarget: this.C,
|
|
1411
1411
|
center: this.getCoordinates(),
|
|
1412
1412
|
scale: this.l,
|
|
1413
1413
|
rotation: this.P,
|
|
@@ -1418,7 +1418,7 @@ class z {
|
|
|
1418
1418
|
}) : o.fire("transforming", {
|
|
1419
1419
|
action: A,
|
|
1420
1420
|
type: "transforming",
|
|
1421
|
-
|
|
1421
|
+
transformtarget: this.C,
|
|
1422
1422
|
center: this.C[0].getTransformOrigin(),
|
|
1423
1423
|
scale: this.l,
|
|
1424
1424
|
rotation: this.P,
|
|
@@ -1552,10 +1552,9 @@ class IA extends(g(r(a))){
|
|
|
1552
1552
|
}).addTo(this.R);
|
|
1553
1553
|
}
|
|
1554
1554
|
remove() {
|
|
1555
|
-
this.map && this.
|
|
1556
|
-
this.
|
|
1557
|
-
delete this.
|
|
1558
|
-
delete this.S);
|
|
1555
|
+
this.map && (this.N(), this.TransformHelper.dispose(), this.R.remove(), this.layerRenderer && this.layerRenderer.setToRedraw(),
|
|
1556
|
+
delete this.T, delete this.R, delete this.map, delete this.layer, delete this.layerRenderer,
|
|
1557
|
+
delete this.container, delete this.S);
|
|
1559
1558
|
}
|
|
1560
1559
|
N() {
|
|
1561
1560
|
this.container && this.map && (this.map.off("dom:mousemove", this.K, this), this.map.off("dom:mousedown", this.G, this),
|
|
@@ -1593,7 +1592,8 @@ class IA extends(g(r(a))){
|
|
|
1593
1592
|
"transform" === this.mouseAction && (this.firstDownPoint = null, this._(), this.tA = !0,
|
|
1594
1593
|
this.fire("transformend", {
|
|
1595
1594
|
action: this.iA,
|
|
1596
|
-
type: "transformend"
|
|
1595
|
+
type: "transformend",
|
|
1596
|
+
transformtarget: this.S.getTargets()
|
|
1597
1597
|
})), this.mouseAction = "moving", "xyzScale" !== this.U && (this.U = "translate"),
|
|
1598
1598
|
this.map.config("zoomable", !0), this.map.config("draggable", !0), this.layerRenderer && this.layerRenderer.setToRedraw();
|
|
1599
1599
|
}
|
|
@@ -1626,10 +1626,10 @@ class IA extends(g(r(a))){
|
|
|
1626
1626
|
}));
|
|
1627
1627
|
}
|
|
1628
1628
|
IA(t) {
|
|
1629
|
-
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 = b(this.map, this.S.getTranslation());
|
|
1630
1630
|
s.add(I, I, o);
|
|
1631
1631
|
const g = s.copy([], t.translate), r = t.scaling;
|
|
1632
|
-
let a =
|
|
1632
|
+
let a = m(this.S, this.map);
|
|
1633
1633
|
a = s.set([], a, a, a), s.multiply(g, g, a), s.multiply(a, a, r), s.add(g, g, I),
|
|
1634
1634
|
e.fromRotationTranslationScale(t.localTransform, [ 0, 0, 0, 1 ], g, a);
|
|
1635
1635
|
this.q().forEach((t => {
|
|
@@ -1638,7 +1638,7 @@ class IA extends(g(r(a))){
|
|
|
1638
1638
|
const i = s.copy([], t.translate), n = 170 / 177;
|
|
1639
1639
|
t.scaling = [ n, n, n ];
|
|
1640
1640
|
const o = t.scaling, g = t.rotation;
|
|
1641
|
-
let r =
|
|
1641
|
+
let r = m(this.S, this.map);
|
|
1642
1642
|
r = s.set([], r, r, r), s.multiply(i, i, r), s.multiply(r, r, o), s.add(i, i, I);
|
|
1643
1643
|
const a = A.fromEuler([], g[0], g[1], g[2]);
|
|
1644
1644
|
e.fromRotationTranslationScale(t.localTransform, a, i, r);
|
|
@@ -1653,7 +1653,7 @@ class IA extends(g(r(a))){
|
|
|
1653
1653
|
}
|
|
1654
1654
|
eA(A) {
|
|
1655
1655
|
if ("transform" === this.mouseAction) {
|
|
1656
|
-
const A = this.J(), e =
|
|
1656
|
+
const A = this.J(), e = b(this.map, this.S.getTranslation()), t = this.S.I();
|
|
1657
1657
|
let s = null, n = null;
|
|
1658
1658
|
if (e[2] + t < .01 && "z-translate" !== this.iA) s = this.gA(this.currentMousePosition),
|
|
1659
1659
|
n = this.gA(this.lastMousePosition); else {
|
|
@@ -1697,7 +1697,7 @@ class IA extends(g(r(a))){
|
|
|
1697
1697
|
return n ? (n[0] - .01) * I : I;
|
|
1698
1698
|
}
|
|
1699
1699
|
CA() {
|
|
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 =
|
|
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 = b(A, this.S.getTranslation());
|
|
1701
1701
|
return s.add(i, i, n), i;
|
|
1702
1702
|
}
|
|
1703
1703
|
$(t) {
|
|
@@ -1712,7 +1712,7 @@ class IA extends(g(r(a))){
|
|
|
1712
1712
|
if (this.map.getPitch()) return !1;
|
|
1713
1713
|
const A = this.map.cameraPosition, e = this.map.coordinateToPointAtRes(this.map.getCenter(), this.map.getGLRes());
|
|
1714
1714
|
s.set(e, e.x, e.y, 0);
|
|
1715
|
-
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 = b(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);
|
|
1716
1716
|
return s.angle(g, r) < 1 / 180 * Math.PI;
|
|
1717
1717
|
}
|
|
1718
1718
|
AA() {
|
|
@@ -1817,7 +1817,7 @@ class IA extends(g(r(a))){
|
|
|
1817
1817
|
const s = this.map;
|
|
1818
1818
|
if (!(s && this.DA && this.layerRenderer && this.layerRenderer.canvas)) return null;
|
|
1819
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;
|
|
1820
|
-
(this.tA || g || !this.
|
|
1820
|
+
(this.tA || g || !this.mA || this.mA !== t) && (this.DA.render(e, o, !0), this.mA = t,
|
|
1821
1821
|
this.tA = !1);
|
|
1822
1822
|
return this.DA.pick(n, I, 10, o, {
|
|
1823
1823
|
viewMatrix: this.map.viewMatrix,
|
|
@@ -1832,7 +1832,7 @@ class IA extends(g(r(a))){
|
|
|
1832
1832
|
width: () => this.map ? this.map.width * A : 1,
|
|
1833
1833
|
height: () => this.map ? this.map.height * A : 1
|
|
1834
1834
|
};
|
|
1835
|
-
this.
|
|
1835
|
+
this.bA = new t.MeshShader({
|
|
1836
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",
|
|
1837
1837
|
frag: "precision mediump float;\n\nuniform vec4 color;\n\n\n\nvoid main() {\n\n gl_FragColor = color;\n\n}\n\n",
|
|
1838
1838
|
uniforms: [ "color", {
|
|
@@ -1868,9 +1868,9 @@ class IA extends(g(r(a))){
|
|
|
1868
1868
|
this.helperScene.setMeshes(A);
|
|
1869
1869
|
const e = this.layerRenderer.getFrameContext();
|
|
1870
1870
|
if (e && e.renderTarget && this.layerRenderer.getFrameTimestamp() !== e.timestamp) return;
|
|
1871
|
-
this.nA(), this.
|
|
1871
|
+
this.nA(), this.bA.filter = e && e.sceneFilter;
|
|
1872
1872
|
const t = e && e.renderTarget && e.renderTarget.fbo;
|
|
1873
|
-
this.renderer.render(this.
|
|
1873
|
+
this.renderer.render(this.bA, this.uA, this.helperScene, t);
|
|
1874
1874
|
}
|
|
1875
1875
|
q() {
|
|
1876
1876
|
let A = [];
|
|
@@ -1896,5 +1896,5 @@ IA.mergeOptions({
|
|
|
1896
1896
|
|
|
1897
1897
|
export { IA as TransformControl };
|
|
1898
1898
|
|
|
1899
|
-
"undefined" != typeof console && console.log("@maptalks/transform-control v0.105.
|
|
1899
|
+
"undefined" != typeof console && console.log("@maptalks/transform-control v0.105.4");
|
|
1900
1900
|
//# sourceMappingURL=transform-control.es.js.map
|