@maptalks/transform-control 0.7.0 → 0.82.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.
- package/dist/transform-control.js +6 -6
- package/dist/transform-control.mjs +227 -216
- package/package.json +54 -56
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @maptalks/transform-control v0.
|
|
2
|
+
* @maptalks/transform-control v0.82.0
|
|
3
3
|
* LICENSE : UNLICENSED
|
|
4
|
-
* (c) 2016-
|
|
4
|
+
* (c) 2016-2023 maptalks.org
|
|
5
5
|
*/
|
|
6
6
|
import { quat as A, mat4 as t, reshader as e, vec3 as s, vec2 as i, GroupGLLayer as n } from "@maptalks/gl";
|
|
7
7
|
|
|
@@ -757,29 +757,33 @@ const w = {
|
|
|
757
757
|
nodes: [ 0 ]
|
|
758
758
|
} ]
|
|
759
759
|
}
|
|
760
|
-
},
|
|
760
|
+
}, f = [];
|
|
761
761
|
|
|
762
|
-
function
|
|
763
|
-
const a = [], h = A.fromEuler([], n[0], n[1], n[2]), g = t.fromRotationTranslationScale([], h, i, o)
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
762
|
+
function B(s, i, n, o, I, r) {
|
|
763
|
+
const a = [], h = A.fromEuler([], n[0], n[1], n[2]), g = t.fromRotationTranslationScale([], h, i, o);
|
|
764
|
+
return function(A) {
|
|
765
|
+
return new c.GLTFLoader("", w[A]).load().then(A => A);
|
|
766
|
+
}(s).then(A => {
|
|
767
767
|
const s = e.GLTFHelper.exportGLTFPack(A).getMeshesInfo(), h = new e.Material({
|
|
768
768
|
color: I
|
|
769
769
|
});
|
|
770
|
-
s.forEach(
|
|
770
|
+
s.forEach(A => {
|
|
771
771
|
const s = new e.Mesh(A.geometry, h);
|
|
772
772
|
s.setUniform("uPickingId", r);
|
|
773
773
|
const c = s.getDefines();
|
|
774
774
|
c.HAS_PICKING_ID = 2, s.setDefines(c), s.translate = i, s.rotation = n, s.scaling = o,
|
|
775
775
|
t.multiply(s.localTransform, g, A.nodeMatrix), s.originTransform = t.copy([], s.localTransform),
|
|
776
776
|
s.originColor = I, a.push(s);
|
|
777
|
-
})
|
|
778
|
-
})
|
|
777
|
+
});
|
|
778
|
+
}), a;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
function C(A, t) {
|
|
782
|
+
return Math.abs(A) * Math.sign(t);
|
|
779
783
|
}
|
|
780
784
|
|
|
781
|
-
function
|
|
782
|
-
const i = A.getCoordinates(), n = e.coordinateToPointAtRes(i, e.getGLRes()), I = [ n.x, n.y, 0 ], r = A.getTranslation();
|
|
785
|
+
function P(A, e) {
|
|
786
|
+
const i = A.getCoordinates(), n = e.coordinateToPointAtRes(i, e.getGLRes()), I = [ n.x, n.y, 0 ], r = m(e, A.getTranslation());
|
|
783
787
|
s.add(I, I, r);
|
|
784
788
|
const a = function(A, t, e, s) {
|
|
785
789
|
return A._pointAtResToContainerPoint(t, e, s);
|
|
@@ -788,11 +792,11 @@ function C(A, e) {
|
|
|
788
792
|
const h = function(A, e, i, n) {
|
|
789
793
|
if (n) {
|
|
790
794
|
const I = i / A._getResolution(), r = A.width / 2, a = A.height / 2;
|
|
791
|
-
|
|
795
|
+
f[0] = (e.x - r) / r, f[1] = e.y / a - 1, f[3] = n * I;
|
|
792
796
|
const h = t.invert([], A.projViewMatrix);
|
|
793
|
-
s.transformMat4(
|
|
797
|
+
s.transformMat4(f, f, h);
|
|
794
798
|
const g = A.getGLScale();
|
|
795
|
-
return s.set(
|
|
799
|
+
return s.set(f, f[0] / g, f[1] / g, f[2] / g), s.scale(f, f, 1 / I), new o.Point(f[0], f[1]);
|
|
796
800
|
}
|
|
797
801
|
{
|
|
798
802
|
const t = A.containerPointToCoordinate(e);
|
|
@@ -802,7 +806,13 @@ function C(A, e) {
|
|
|
802
806
|
return Math.sqrt(Math.pow(h.x - I[0], 2) + Math.pow(h.y - I[1], 2)) / 5.272881136101205;
|
|
803
807
|
}
|
|
804
808
|
|
|
805
|
-
|
|
809
|
+
function m(A, t) {
|
|
810
|
+
if (!A) return t;
|
|
811
|
+
const e = A.distanceToPointAtRes(t[0], t[1], A.getGLRes()), i = A.altitudeToPoint(t[2], A.getGLRes());
|
|
812
|
+
return s.set([], C(e.x, t[0]), C(e.y, t[1]), C(i, t[2]));
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
class u {
|
|
806
816
|
constructor(A) {
|
|
807
817
|
this.A = A, this._meshes = this.t();
|
|
808
818
|
}
|
|
@@ -810,7 +820,7 @@ class P {
|
|
|
810
820
|
this.A = A;
|
|
811
821
|
}
|
|
812
822
|
t() {
|
|
813
|
-
const A = [], t = 340 / 177, e =
|
|
823
|
+
const A = [], t = 340 / 177, e = B("jiantou", [ 1.2 * t, 0, 0 ], [ 0, 0, 90 ], [ t, t, t ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 7), s = B("jiantou", [ 0, 1.2 * t, 0 ], [ 0, 0, 180 ], [ t, t, t ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 8), i = B("jiantou", [ -1.2 * t, 0, 0 ], [ 0, 0, 270 ], [ t, t, t ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 9), n = B("jiantou", [ 0, -1.2 * t, 0 ], [ 0, 0, 0 ], [ t, t, t ], [ 89 / 255, 206 / 255, 147 / 255, 0 ], 10);
|
|
814
824
|
return A.push(e, s, i, n), A;
|
|
815
825
|
}
|
|
816
826
|
getMeshes() {
|
|
@@ -818,7 +828,7 @@ class P {
|
|
|
818
828
|
}
|
|
819
829
|
}
|
|
820
830
|
|
|
821
|
-
class
|
|
831
|
+
class Q {
|
|
822
832
|
constructor(A) {
|
|
823
833
|
this.A = A, this._meshes = this.t();
|
|
824
834
|
}
|
|
@@ -826,15 +836,15 @@ class m {
|
|
|
826
836
|
this.A = A;
|
|
827
837
|
}
|
|
828
838
|
t() {
|
|
829
|
-
const A = [], t =
|
|
830
|
-
return A.push(
|
|
839
|
+
const A = [], t = B("xuanzhuan", [ 0, 0, 0 ], [ 180, 0, 0 ], [ 340 / 177 * .5, 340 / 177 * .5, 340 / 177 * .5 ], [ 50 / 255, 130 / 255, 184 / 255, .8 ], 11);
|
|
840
|
+
return A.push(t), A;
|
|
831
841
|
}
|
|
832
842
|
getMeshes() {
|
|
833
843
|
return this._meshes;
|
|
834
844
|
}
|
|
835
845
|
}
|
|
836
846
|
|
|
837
|
-
class
|
|
847
|
+
class l {
|
|
838
848
|
constructor(A) {
|
|
839
849
|
this.A = A, this._meshes = this.t();
|
|
840
850
|
}
|
|
@@ -842,15 +852,15 @@ class u {
|
|
|
842
852
|
this.A = A;
|
|
843
853
|
}
|
|
844
854
|
t() {
|
|
845
|
-
const A = [], t =
|
|
846
|
-
return A.push(
|
|
855
|
+
const A = [], t = B("yuanhuan", [ 0, 0, 0 ], [ 0, 0, 0 ], [ 340 / 177 * .5, 340 / 177 * .5, 340 / 177 * .5 ], [ 149 / 255, 179 / 255, 199 / 255, .5 ], 12);
|
|
856
|
+
return A.push(t), A;
|
|
847
857
|
}
|
|
848
858
|
getMeshes() {
|
|
849
859
|
return this._meshes;
|
|
850
860
|
}
|
|
851
861
|
}
|
|
852
862
|
|
|
853
|
-
class
|
|
863
|
+
class b {
|
|
854
864
|
constructor(A) {
|
|
855
865
|
this.A = A, this._meshes = this.t();
|
|
856
866
|
}
|
|
@@ -858,7 +868,7 @@ class Q {
|
|
|
858
868
|
this.A = A;
|
|
859
869
|
}
|
|
860
870
|
t() {
|
|
861
|
-
const A = [], t =
|
|
871
|
+
const A = [], t = B("plane", [ 0, 0, 0 ], [ 0, 0, 0 ], [ 10, 10, 10 ], [ 1, 0, 0, .5 ], 16);
|
|
862
872
|
return A.push(t), A;
|
|
863
873
|
}
|
|
864
874
|
getMeshes() {
|
|
@@ -866,42 +876,42 @@ class Q {
|
|
|
866
876
|
}
|
|
867
877
|
}
|
|
868
878
|
|
|
869
|
-
const
|
|
879
|
+
const y = [], v = [], M = [], E = [], D = [], p = [ 177 / 170, 177 / 170, 177 / 170 ], d = [ 1, 2, 3, 4, 12 ];
|
|
870
880
|
|
|
871
|
-
class
|
|
881
|
+
class x {
|
|
872
882
|
constructor() {
|
|
873
|
-
this.translate = new
|
|
874
|
-
this._meshes = this.t(), this.
|
|
883
|
+
this.translate = new u, this.rotation = new Q, this.scaling = new l, this.planeHelper = new b,
|
|
884
|
+
this._meshes = this.t(), this.s = !0;
|
|
875
885
|
}
|
|
876
886
|
t() {
|
|
877
887
|
const A = {};
|
|
878
888
|
A.translate = this.translate.getMeshes(), A.rotation = this.rotation.getMeshes(),
|
|
879
889
|
A.scaling = this.scaling.getMeshes(), A.planeHelper = this.planeHelper.getMeshes();
|
|
880
|
-
const t = 340 / 177, e =
|
|
890
|
+
const t = 340 / 177, e = B("yuanhuan41", [ -2.745 * t, 2.745 * t, 0 ], [ 90, 0, 0 ], [ .5 * t, .5 * t, .5 * t ], [ 149 / 255, 179 / 255, 199 / 255, .6 ], 1), s = B("yuanhuan41", [ 2.745 * t, 2.745 * t, 0 ], [ -90, 0, 180 ], [ .5 * t, .5 * t, .5 * t ], [ 50 / 255, 130 / 255, 184 / 255, .5 ], 2), i = B("yuanhuan41", [ 2.745 * t, -2.745 * t, 0 ], [ 90, 0, 180 ], [ .5 * t, .5 * t, .5 * t ], [ 149 / 255, 179 / 255, 199 / 255, .6 ], 3), n = B("yuanhuan41", [ -2.745 * t, -2.745 * t, 0 ], [ -90, 0, 0 ], [ .5 * t, .5 * t, .5 * t ], [ 50 / 255, 130 / 255, 184 / 255, .5 ], 4), o = B("yuanpan", [ 0, 0, 0 ], [ 90, 0, 0 ], [ .5 * t, .5 * t, .5 * t ], [ 89 / 255, 206 / 255, 147 / 255, .5 ], 5), I = B("zzhou", [ 0, 0, 6.5 ], [ 90, 0, 0 ], [ 1, 1, 1 ], [ 14 / 255, 127 / 255, 191 / 255, 1 ], 6);
|
|
881
891
|
return A.translate.push(e, s, i, n, o, I), A;
|
|
882
892
|
}
|
|
883
893
|
updateMatrix(e, i, n, o, I) {
|
|
884
894
|
const r = i.getCoordinates(), a = e.coordinateToPointAtRes(r, e.getGLRes()), h = i.getPointZ();
|
|
885
|
-
s.set(
|
|
886
|
-
const g = s.copy(
|
|
887
|
-
s.add(
|
|
895
|
+
s.set(v, a.x, a.y, h);
|
|
896
|
+
const g = s.copy(y, I), c = m(e, i.getTranslation());
|
|
897
|
+
s.add(v, v, c), s.add(v, v, g);
|
|
888
898
|
for (const I in this._meshes) for (let r = 0; r < this._meshes[I].length; r++) {
|
|
889
899
|
const a = this._meshes[I][r];
|
|
890
900
|
for (let I = 0; I < a.length; I++) {
|
|
891
|
-
const r = a[I], h = r.getUniform("uPickingId"), g = s.copy(
|
|
892
|
-
if (11 === h && (this.
|
|
893
|
-
r.rotation[2] += n, c[0] = 360, c[2] -= 90)),
|
|
901
|
+
const r = a[I], h = r.getUniform("uPickingId"), g = s.copy(y, r.translate), c = [ r.rotation[0], r.rotation[1], r.rotation[2] ], w = r.scaling;
|
|
902
|
+
if (11 === h && (this.s ? (c[2] += n, r.rotation[2] += n) : this.s || (c[2] += n,
|
|
903
|
+
r.rotation[2] += n, c[0] = 360, c[2] -= 90)), d.indexOf(h) > -1) if (12 !== h) w[0] += o,
|
|
894
904
|
w[1] += o, w[2] += o; else {
|
|
895
905
|
const A = this._meshes.translate[4][0];
|
|
896
906
|
w[0] = 1.2 * A.scaling[0], w[1] = 1.2 * A.scaling[0], w[2] = 1.2 * A.scaling[0];
|
|
897
907
|
}
|
|
898
|
-
let
|
|
899
|
-
if (
|
|
900
|
-
const A = s.multiply(
|
|
908
|
+
let f = P(i, e);
|
|
909
|
+
if (f = s.set(M, f, f, f), s.multiply(g, g, f), s.multiply(f, f, w), 1 === h || 2 === h || 3 === h || 4 === h) {
|
|
910
|
+
const A = s.multiply(D, w, p);
|
|
901
911
|
s.multiply(g, g, A);
|
|
902
912
|
}
|
|
903
|
-
const
|
|
904
|
-
s.add(g, g,
|
|
913
|
+
const B = A.fromEuler(E, c[0], c[1], c[2]);
|
|
914
|
+
s.add(g, g, v), t.fromRotationTranslationScale(r.localTransform, B, g, f);
|
|
905
915
|
}
|
|
906
916
|
}
|
|
907
917
|
}
|
|
@@ -910,8 +920,8 @@ class p {
|
|
|
910
920
|
return t.translate = this._meshes.translate, A && "translate" !== A && (t[A] = this._meshes[A]),
|
|
911
921
|
t;
|
|
912
922
|
}
|
|
913
|
-
|
|
914
|
-
this.
|
|
923
|
+
i(A) {
|
|
924
|
+
this.s = A;
|
|
915
925
|
}
|
|
916
926
|
dispose() {
|
|
917
927
|
for (const A in this._meshes) for (let t = 0; t < this._meshes[A].length; t++) {
|
|
@@ -924,302 +934,303 @@ class p {
|
|
|
924
934
|
}
|
|
925
935
|
}
|
|
926
936
|
|
|
927
|
-
const
|
|
937
|
+
const F = [ 5, 6, 7, 8, 9, 10 ], U = [ 5, 7, 8, 9, 10 ], k = [ 2, 4, 11 ], L = [ 1, 3, 12 ], V = [ 12, 16 ], O = [ 1, 2, 3, 4 ], S = [ 1, 2, 3, 4, 12 ], H = [], N = [], T = [], K = [], _ = [], R = [], G = [];
|
|
928
938
|
|
|
929
|
-
class
|
|
939
|
+
class j extends(I(r(a))){
|
|
930
940
|
constructor(A) {
|
|
931
|
-
super(A), this.options = A, this.mouseAction = "moving", this.
|
|
932
|
-
this.TransformHelper = new
|
|
941
|
+
super(A), this.options = A, this.mouseAction = "moving", this.o = "translate", this.I = !0,
|
|
942
|
+
this.TransformHelper = new x, this.helperScene = new e.Scene([]), this.addToMapCount = 0;
|
|
933
943
|
}
|
|
934
944
|
enable() {
|
|
935
|
-
return this.
|
|
945
|
+
return this.I = !0, this.layerRenderer && this.layerRenderer.setToRedraw(), this;
|
|
936
946
|
}
|
|
937
947
|
disable() {
|
|
938
|
-
return this.
|
|
948
|
+
return this.I = !1, this.layerRenderer && this.layerRenderer.setToRedraw(), this.map && this.map.resetCursor(),
|
|
939
949
|
this;
|
|
940
950
|
}
|
|
941
951
|
isEnable() {
|
|
942
|
-
return this.
|
|
952
|
+
return this.I;
|
|
943
953
|
}
|
|
944
|
-
|
|
945
|
-
|
|
954
|
+
h(A) {
|
|
955
|
+
F.indexOf(A) > -1 ? this.o = "translate" : k.indexOf(A) > -1 ? this.o = "rotation" : L.indexOf(A) > -1 ? this.o = "scaling" : this.o = "translate";
|
|
946
956
|
}
|
|
947
|
-
|
|
948
|
-
return this.
|
|
957
|
+
g() {
|
|
958
|
+
return this.o;
|
|
949
959
|
}
|
|
950
960
|
addTo(A) {
|
|
951
|
-
this.map && (this.
|
|
952
|
-
this.addToMapCount++, this.map = A, this.container = A.getContainer(), A.on("dom:mousemove", this.
|
|
953
|
-
A.on("dom:mousedown", this.
|
|
954
|
-
this.
|
|
961
|
+
this.map && (this.B(), console.warn("transform control has been added to a map, it suggest remove from the map before")),
|
|
962
|
+
this.addToMapCount++, this.map = A, this.container = A.getContainer(), A.on("dom:mousemove", this.C, this),
|
|
963
|
+
A.on("dom:mousedown", this.P, this), A.on("dom:mouseup", this.m, this), A.on("zooming moving dragrotating", this.u, this),
|
|
964
|
+
this.l();
|
|
955
965
|
}
|
|
956
966
|
remove() {
|
|
957
|
-
this.map && this.container && this.layerRenderer && (this.
|
|
967
|
+
this.map && this.container && this.layerRenderer && (this.B(), this.TransformHelper.dispose(),
|
|
958
968
|
this.layerRenderer.setToRedraw(), delete this.map, delete this.layer, delete this.layerRenderer,
|
|
959
|
-
delete this.container, delete this.
|
|
969
|
+
delete this.container, delete this.v);
|
|
960
970
|
}
|
|
961
|
-
|
|
962
|
-
this.container && this.map && (this.map.off("mousemove", this.
|
|
963
|
-
this.map.off("mouseup", this.
|
|
971
|
+
B() {
|
|
972
|
+
this.container && this.map && (this.map.off("mousemove", this.C, this), this.map.off("mousedown", this.P, this),
|
|
973
|
+
this.map.off("mouseup", this.m, this), this.map.off("zooming moving dragrotating", this.u, this),
|
|
964
974
|
this.layer && this.layer.off("renderend", this.render, this));
|
|
965
975
|
}
|
|
966
|
-
|
|
967
|
-
if (this.
|
|
976
|
+
C(A) {
|
|
977
|
+
if (this.M()) {
|
|
968
978
|
if (this.currentMousePosition = {
|
|
969
979
|
x: A.containerPoint.x,
|
|
970
980
|
y: A.containerPoint.y
|
|
971
981
|
}, "moving" === this.mouseAction) {
|
|
972
|
-
const A = this.
|
|
973
|
-
this.currentPickingObject = this.
|
|
974
|
-
6 === this.currentPickingObject.pickingId ? this.
|
|
975
|
-
this.
|
|
982
|
+
const A = this.D();
|
|
983
|
+
this.currentPickingObject = this.p(this.currentMousePosition, A, "meshes"), this.currentPickingObject && null != this.currentPickingObject.pickingId ? (this.h(this.currentPickingObject.pickingId),
|
|
984
|
+
6 === this.currentPickingObject.pickingId ? this.F(!0) : this.F(!1)) : (this.F(!1),
|
|
985
|
+
this.h()), this.U();
|
|
976
986
|
}
|
|
977
|
-
this.
|
|
987
|
+
this.k(this.currentMousePosition);
|
|
978
988
|
}
|
|
979
989
|
}
|
|
980
|
-
|
|
981
|
-
if (!this.
|
|
982
|
-
const t = this.
|
|
990
|
+
P(A) {
|
|
991
|
+
if (!this.M()) return;
|
|
992
|
+
const t = this.D();
|
|
983
993
|
this.currentMousePosition = {
|
|
984
994
|
x: A.containerPoint.x,
|
|
985
995
|
y: A.containerPoint.y
|
|
986
|
-
}, this.
|
|
987
|
-
this.firstDownPoint = this.
|
|
988
|
-
this.
|
|
996
|
+
}, this.L = !0, this.currentPickingObject = this.p(this.currentMousePosition, t, "meshes"),
|
|
997
|
+
this.firstDownPoint = this.p(this.currentMousePosition, t, "meshes"), this.currentPickingObject && null != this.currentPickingObject.meshId ? (this.mouseAction = "transform",
|
|
998
|
+
this.V(this.currentPickingObject.pickingId), this.map.config("zoomable", !1), this.map.config("draggable", !1),
|
|
989
999
|
this.layerRenderer && this.layerRenderer.setToRedraw()) : (this.mouseAction = "pan",
|
|
990
|
-
this.map.config("zoomable", !0), this.map.config("draggable", !0), this.
|
|
1000
|
+
this.map.config("zoomable", !0), this.map.config("draggable", !0), this.O()), this.lastMousePosition = this.currentMousePosition,
|
|
991
1001
|
this.lastPickingObject = this.currentPickingObject, this.lastPickingMesh = t[this.currentPickingObject.meshId];
|
|
992
1002
|
}
|
|
993
|
-
|
|
994
|
-
"transform" === this.mouseAction && (this.firstDownPoint = null, this.
|
|
1003
|
+
m() {
|
|
1004
|
+
"transform" === this.mouseAction && (this.firstDownPoint = null, this.O(), this.L = !0,
|
|
995
1005
|
this.fire("transformend", {
|
|
996
|
-
action: this.
|
|
1006
|
+
action: this.S,
|
|
997
1007
|
type: "transformend"
|
|
998
|
-
})), this.mouseAction = "moving", this.
|
|
1008
|
+
})), this.mouseAction = "moving", this.o = "translate", this.map.config("zoomable", !0),
|
|
999
1009
|
this.map.config("draggable", !0), this.layerRenderer && this.layerRenderer.setToRedraw();
|
|
1000
1010
|
}
|
|
1001
|
-
|
|
1011
|
+
u() {
|
|
1002
1012
|
const A = this.TransformHelper.planeHelper.getMeshes()[0][0], t = this.map.getBearing();
|
|
1003
|
-
A.rotation[2] = -t, this.
|
|
1013
|
+
A.rotation[2] = -t, this.H();
|
|
1004
1014
|
}
|
|
1005
|
-
|
|
1006
|
-
this.
|
|
1007
|
-
this.
|
|
1015
|
+
H() {
|
|
1016
|
+
this.M() && (this.TransformHelper.updateMatrix(this.map, this.v, 0, 0, [ 0, 0, 0 ]),
|
|
1017
|
+
this.L = !0);
|
|
1008
1018
|
}
|
|
1009
1019
|
picked(A) {
|
|
1010
1020
|
if (!this.layerRenderer) return !1;
|
|
1011
|
-
const t = this.
|
|
1021
|
+
const t = this.D(), e = this.map;
|
|
1012
1022
|
let s = A;
|
|
1013
1023
|
A instanceof h || (s = e.coordinateToContainerPoint(new g(A)));
|
|
1014
|
-
const i = this.
|
|
1024
|
+
const i = this.p(s, t, "picked");
|
|
1015
1025
|
return !(!i || null === i.meshId);
|
|
1016
1026
|
}
|
|
1017
|
-
|
|
1018
|
-
const A = this.TransformHelper.getMeshes("scaling").scaling[0][0]
|
|
1019
|
-
A.scaling = [
|
|
1027
|
+
O() {
|
|
1028
|
+
const A = this.TransformHelper.getMeshes("scaling").scaling[0][0];
|
|
1029
|
+
A.scaling = [ 340 / 177 * .6, 340 / 177 * .6, 340 / 177 * .6 ], this.layerRenderer && (this.N(A),
|
|
1030
|
+
this.T());
|
|
1020
1031
|
}
|
|
1021
|
-
|
|
1022
|
-
this.TransformHelper._meshes.translate.forEach(
|
|
1032
|
+
T() {
|
|
1033
|
+
this.TransformHelper._meshes.translate.forEach(A => {
|
|
1023
1034
|
for (let t = 0; t < A.length; t++) {
|
|
1024
1035
|
const e = A[t];
|
|
1025
|
-
|
|
1036
|
+
O.indexOf(e.getUniform("uPickingId")) > -1 && e.material.set("color", e.originColor);
|
|
1026
1037
|
}
|
|
1027
|
-
})
|
|
1038
|
+
});
|
|
1028
1039
|
}
|
|
1029
|
-
|
|
1030
|
-
const i = this.
|
|
1040
|
+
N(e) {
|
|
1041
|
+
const i = this.v.getCoordinates(), n = this.map.coordinateToPointAtRes(i, this.map.getGLRes()), o = [ n.x, n.y, 0 ], I = m(this.map, this.v.getTranslation());
|
|
1031
1042
|
s.add(o, o, I);
|
|
1032
1043
|
const r = s.copy([], e.translate), a = e.scaling;
|
|
1033
|
-
let h =
|
|
1044
|
+
let h = P(this.v, this.map);
|
|
1034
1045
|
h = s.set([], h, h, h), s.multiply(r, r, h), s.multiply(h, h, a), s.add(r, r, o),
|
|
1035
1046
|
t.fromRotationTranslationScale(e.localTransform, [ 0, 0, 0, 1 ], r, h);
|
|
1036
|
-
this.
|
|
1047
|
+
this.D().forEach(e => {
|
|
1037
1048
|
const i = e.getUniform("uPickingId");
|
|
1038
1049
|
if (1 === i || 3 === i || 2 === i || 4 === i) {
|
|
1039
1050
|
const i = s.copy([], e.translate), n = 170 / 177;
|
|
1040
1051
|
e.scaling = [ n, n, n ];
|
|
1041
1052
|
const I = e.scaling, r = e.rotation;
|
|
1042
|
-
let a =
|
|
1053
|
+
let a = P(this.v, this.map);
|
|
1043
1054
|
a = s.set([], a, a, a), s.multiply(i, i, a), s.multiply(a, a, I), s.add(i, i, o);
|
|
1044
1055
|
const h = A.fromEuler([], r[0], r[1], r[2]);
|
|
1045
1056
|
t.fromRotationTranslationScale(e.localTransform, h, i, a);
|
|
1046
1057
|
}
|
|
1047
|
-
})
|
|
1058
|
+
});
|
|
1048
1059
|
}
|
|
1049
|
-
|
|
1060
|
+
K(A) {
|
|
1050
1061
|
const t = this.map.containerPointToCoordinate(A), e = this.map.coordinateToPointAtRes(t, this.map.getGLRes());
|
|
1051
1062
|
return {
|
|
1052
1063
|
point: [ e.x, e.y ]
|
|
1053
1064
|
};
|
|
1054
1065
|
}
|
|
1055
|
-
|
|
1066
|
+
k(A) {
|
|
1056
1067
|
if ("transform" === this.mouseAction) {
|
|
1057
|
-
const A = this.
|
|
1068
|
+
const A = this.g(), t = m(this.map, this.v.getTranslation()), e = this.v.getPointZ(), n = this.v.getCoordinates(), o = this.map.coordinateToPointAtRes(n, this.map.getGLRes()), I = this.v.getRotation(), r = this.v.getScale();
|
|
1058
1069
|
let a = null, c = null;
|
|
1059
|
-
if (t[2] + e < .01 && "z-translate" !== this.
|
|
1060
|
-
c = this.
|
|
1070
|
+
if (t[2] + e < .01 && "z-translate" !== this.S) a = this.K(this.currentMousePosition),
|
|
1071
|
+
c = this.K(this.lastMousePosition); else {
|
|
1061
1072
|
const A = this.TransformHelper.planeHelper.getMeshes()[0];
|
|
1062
|
-
if (a = this.
|
|
1073
|
+
if (a = this.p(this.currentMousePosition, A, "plane"), c = this.p(this.lastMousePosition, A, "plane"),
|
|
1063
1074
|
!a || null === a.meshId || !c || null === c.meshId) return;
|
|
1064
1075
|
}
|
|
1065
|
-
const w = [ 0, 0, 0 ],
|
|
1066
|
-
let
|
|
1076
|
+
const w = [ 0, 0, 0 ], f = [ 0, 0, 0 ];
|
|
1077
|
+
let B = 0, C = 0, P = 0;
|
|
1067
1078
|
if ("translate" === A) {
|
|
1068
|
-
if ("xy-translate" === this.
|
|
1079
|
+
if ("xy-translate" === this.S) {
|
|
1069
1080
|
const A = a.point[0] - c.point[0], t = a.point[1] - c.point[1];
|
|
1070
1081
|
w[0] = A, w[1] = t;
|
|
1071
|
-
} else if ("x-translate" === this.
|
|
1082
|
+
} else if ("x-translate" === this.S) {
|
|
1072
1083
|
const A = a.point[0] - c.point[0];
|
|
1073
1084
|
w[0] = A;
|
|
1074
|
-
} else if ("y-translate" === this.
|
|
1085
|
+
} else if ("y-translate" === this.S) {
|
|
1075
1086
|
const A = a.point[1] - c.point[1];
|
|
1076
1087
|
w[1] = A;
|
|
1077
|
-
} else if ("z-translate" === this.
|
|
1088
|
+
} else if ("z-translate" === this.S) {
|
|
1078
1089
|
let A = 0;
|
|
1079
|
-
if (this.
|
|
1080
|
-
const t = this.map.getGLRes(), e = this.map._pointAtResToContainerPoint(new h(c.point[0], c.point[1]), t), s = this.map._pointAtResToContainerPoint(new h(a.point[0], a.point[1]), t), n = i.length(i.set(
|
|
1090
|
+
if (this._()) {
|
|
1091
|
+
const t = this.map.getGLRes(), e = this.map._pointAtResToContainerPoint(new h(c.point[0], c.point[1]), t), s = this.map._pointAtResToContainerPoint(new h(a.point[0], a.point[1]), t), n = i.length(i.set(K, a.point[0] - c.point[0], a.point[1] - c.point[1]));
|
|
1081
1092
|
A = s.y < e.y ? n : -n;
|
|
1082
1093
|
} else A = a.point[2] - c.point[2];
|
|
1083
1094
|
w[2] = Math.sign(A) * this.map.pointAtResToAltitude(A, this.map.getGLRes());
|
|
1084
1095
|
}
|
|
1085
|
-
} else if ("rotation" === A) C = this.
|
|
1086
|
-
|
|
1087
|
-
const A = this.
|
|
1088
|
-
|
|
1096
|
+
} else if ("rotation" === A) C = this.R(a.point, c.point), C >= 0 ? this.TransformHelper.i(!0) : this.TransformHelper.i(!1),
|
|
1097
|
+
f[2] += C; else if ("scaling" === A) {
|
|
1098
|
+
const A = this.G(), t = i.length(i.set(K, this.firstDownPoint.point[0] - A[0], this.firstDownPoint.point[1] - A[1])), e = i.length(i.set(K, c.point[0] - A[0], c.point[1] - A[1]));
|
|
1099
|
+
B = this.j(a.point, c.point, A, e, r), P = this.j(a.point, c.point, A, t);
|
|
1089
1100
|
}
|
|
1090
|
-
const
|
|
1091
|
-
|
|
1092
|
-
let
|
|
1093
|
-
|
|
1094
|
-
const
|
|
1095
|
-
if (Math.min(...
|
|
1101
|
+
const u = s.set([], o.x, o.y, n.z || 0), Q = s.add(u, u, w), l = this.map.pointAtResToCoordinate(new g(Q[0], Q[1]), this.map.getGLRes());
|
|
1102
|
+
l.z = Q[2];
|
|
1103
|
+
let b = null;
|
|
1104
|
+
b = B >= 0 ? B : B * (this.options && this.options.scaleStrength || 1);
|
|
1105
|
+
const y = s.add(r, s.set(K, b, b * (r[1] / r[0]), b * (r[2] / r[0])), r);
|
|
1106
|
+
if (Math.min(...y) < .01) {
|
|
1096
1107
|
const A = Math.min(...r);
|
|
1097
|
-
|
|
1108
|
+
y[0] = r[0] * (.01 / A), y[1] = r[1] * (.01 / A), y[2] = r[2] * (.01 / A);
|
|
1098
1109
|
}
|
|
1099
|
-
const
|
|
1100
|
-
this.TransformHelper.updateMatrix(this.map, this.
|
|
1101
|
-
action: this.
|
|
1110
|
+
const v = s.add(I, f, I);
|
|
1111
|
+
this.TransformHelper.updateMatrix(this.map, this.v, C, P, w), this.S.indexOf("translate") > -1 ? this.fire("positionchange", {
|
|
1112
|
+
action: this.S,
|
|
1102
1113
|
type: "positionchange",
|
|
1103
|
-
target: this.
|
|
1104
|
-
coordinate:
|
|
1114
|
+
target: this.v,
|
|
1115
|
+
coordinate: l
|
|
1105
1116
|
}) : this.fire("transforming", {
|
|
1106
|
-
action: this.
|
|
1117
|
+
action: this.S,
|
|
1107
1118
|
type: "transforming",
|
|
1108
|
-
target: this.
|
|
1119
|
+
target: this.v,
|
|
1109
1120
|
translate: t,
|
|
1110
|
-
rotation:
|
|
1111
|
-
scale:
|
|
1121
|
+
rotation: v,
|
|
1122
|
+
scale: y
|
|
1112
1123
|
});
|
|
1113
1124
|
}
|
|
1114
1125
|
this.lastMousePosition = A, this.lastPickingObject = this.currentPickingObject;
|
|
1115
|
-
const t = this.
|
|
1126
|
+
const t = this.D();
|
|
1116
1127
|
this.lastPickingMesh = t[this.currentPickingObject.meshId];
|
|
1117
1128
|
}
|
|
1118
|
-
|
|
1119
|
-
const o = (i.length(i.set(
|
|
1129
|
+
j(A, t, e, s, n) {
|
|
1130
|
+
const o = (i.length(i.set(K, A[0] - e[0], A[1] - e[1])) - i.length(i.set(K, t[0] - e[0], t[1] - e[1]))) / s;
|
|
1120
1131
|
return n ? (n[0] - .01) * o : o;
|
|
1121
1132
|
}
|
|
1122
|
-
|
|
1123
|
-
const A = this.map, t = this.
|
|
1133
|
+
G() {
|
|
1134
|
+
const A = this.map, t = this.v.getCoordinates(), e = A.coordinateToPointAtRes(t, A.getGLRes()), i = s.set(_, e.x, e.y, 0), n = m(A, this.v.getTranslation());
|
|
1124
1135
|
return s.add(i, i, n), i;
|
|
1125
1136
|
}
|
|
1126
|
-
|
|
1127
|
-
const i = this.TransformHelper.planeHelper.getMeshes()[0][0], n = t.getTranslation(
|
|
1128
|
-
let I = A.fromEuler(
|
|
1137
|
+
F(e) {
|
|
1138
|
+
const i = this.TransformHelper.planeHelper.getMeshes()[0][0], n = t.getTranslation(T, i.localTransform), o = t.getScaling(N, i.localTransform);
|
|
1139
|
+
let I = A.fromEuler(H, 0, 0, 0);
|
|
1129
1140
|
const r = this.map.getBearing();
|
|
1130
|
-
e && !this.
|
|
1131
|
-
s.set(i.rotation, 90, 0, -r)) : (90 === i.rotation[0] && (this.
|
|
1141
|
+
e && !this._() ? (I = A.fromEuler(H, 90, 0, -r), 0 === i.rotation[0] && (this.L = !0),
|
|
1142
|
+
s.set(i.rotation, 90, 0, -r)) : (90 === i.rotation[0] && (this.L = !0), s.set(i.rotation, 0, 0, -r)),
|
|
1132
1143
|
t.fromRotationTranslationScale(i.localTransform, I, n, o);
|
|
1133
1144
|
}
|
|
1134
|
-
|
|
1145
|
+
_() {
|
|
1135
1146
|
if (this.map.getPitch()) return !1;
|
|
1136
1147
|
const A = this.map.cameraPosition, t = this.map.coordinateToPointAtRes(this.map.getCenter(), this.map.getGLRes());
|
|
1137
1148
|
s.set(t, t.x, t.y, 0);
|
|
1138
|
-
const e = this.
|
|
1149
|
+
const e = this.v.getCoordinates(), i = this.map.coordinateToPointAtRes(e, this.map.getGLRes()), n = m(this.map, this.v.getTranslation()), o = s.set(T, i.x, i.y, 0), I = s.add(o, o, n), r = s.subtract([], A, I), a = s.subtract([], A, t);
|
|
1139
1150
|
return s.angle(r, a) < 1 / 180 * Math.PI;
|
|
1140
1151
|
}
|
|
1141
|
-
|
|
1142
|
-
const A = this.
|
|
1152
|
+
U() {
|
|
1153
|
+
const A = this.D();
|
|
1143
1154
|
if (this.currentPickingObject && null != this.currentPickingObject.meshId) {
|
|
1144
|
-
this.
|
|
1155
|
+
this.Z(), this.lastPickingObject && null != this.lastPickingObject.meshId && this.lastPickingObject.meshId !== this.currentPickingObject.meshId && this.J();
|
|
1145
1156
|
const t = A[this.currentPickingObject.meshId];
|
|
1146
|
-
if (t &&
|
|
1157
|
+
if (t && V.indexOf(this.currentPickingObject.pickingId) < 0) {
|
|
1147
1158
|
const A = [ t.originColor[0], t.originColor[1], t.originColor[2], .8 ];
|
|
1148
|
-
t.material.set("color", A), this.
|
|
1159
|
+
t.material.set("color", A), this.Y(t, .5);
|
|
1149
1160
|
}
|
|
1150
1161
|
this.layerRenderer.setToRedraw();
|
|
1151
1162
|
} else this.lastPickingObject && null != this.lastPickingObject.meshId && (this.map.resetCursor(),
|
|
1152
|
-
this.
|
|
1163
|
+
this.J(), this.layerRenderer.setToRedraw());
|
|
1153
1164
|
}
|
|
1154
|
-
|
|
1155
|
-
6 === this.currentPickingObject.pickingId ? this.map.setCursor("ns-resize") :
|
|
1165
|
+
Z() {
|
|
1166
|
+
6 === this.currentPickingObject.pickingId ? this.map.setCursor("ns-resize") : U.indexOf(this.currentPickingObject.pickingId) > -1 ? this.map.setCursor("move") : this.map.setCursor("pointer");
|
|
1156
1167
|
}
|
|
1157
|
-
|
|
1168
|
+
J() {
|
|
1158
1169
|
const A = this.lastPickingMesh;
|
|
1159
1170
|
if (!A) return;
|
|
1160
|
-
const t = A.getUniform("uPickingId"), e = this.
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
})
|
|
1171
|
+
const t = A.getUniform("uPickingId"), e = this.D();
|
|
1172
|
+
U.indexOf(t) > -1 ? e.forEach(A => {
|
|
1173
|
+
U.indexOf(A.getUniform("uPickingId")) > -1 && A.material.set("color", A.originColor);
|
|
1174
|
+
}) : S.indexOf(t) > -1 ? e.forEach(A => {
|
|
1164
1175
|
const t = A.getUniform("uPickingId");
|
|
1165
|
-
|
|
1166
|
-
})
|
|
1167
|
-
|
|
1168
|
-
})
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
const e = A.getUniform("uPickingId"), s = this.
|
|
1172
|
-
|
|
1173
|
-
if (
|
|
1176
|
+
O.indexOf(t) > -1 && A.material.set("color", A.originColor);
|
|
1177
|
+
}) : 11 === t && e.forEach(A => {
|
|
1178
|
+
O.indexOf(A.getUniform("uPickingId")) > -1 && A.material.set("color", A.originColor);
|
|
1179
|
+
}), A.material.set("color", A.originColor);
|
|
1180
|
+
}
|
|
1181
|
+
Y(A, t) {
|
|
1182
|
+
const e = A.getUniform("uPickingId"), s = this.D();
|
|
1183
|
+
U.indexOf(e) > -1 ? s.forEach(e => {
|
|
1184
|
+
if (U.indexOf(e.getUniform("uPickingId")) > -1 && e.getUniform("uPickingId") !== A.getUniform("uPickingId")) {
|
|
1174
1185
|
const A = [ e.originColor[0], e.originColor[1], e.originColor[2], t ];
|
|
1175
1186
|
e.material.set("color", A);
|
|
1176
1187
|
}
|
|
1177
|
-
})
|
|
1188
|
+
}) : "scaling" === this.o ? s.forEach(A => {
|
|
1178
1189
|
const t = A.getUniform("uPickingId");
|
|
1179
1190
|
if (1 === t || 3 === t || 2 === t || 4 === t) {
|
|
1180
1191
|
const t = [ 149 / 255, 179 / 255, 199 / 255, .8 ];
|
|
1181
1192
|
A.material.set("color", t);
|
|
1182
1193
|
}
|
|
1183
|
-
})
|
|
1194
|
+
}) : "rotation" === this.o && s.forEach(A => {
|
|
1184
1195
|
const t = A.getUniform("uPickingId");
|
|
1185
1196
|
if (1 === t || 3 === t || 2 === t || 4 === t) {
|
|
1186
1197
|
const t = A.originColor;
|
|
1187
1198
|
A.material.set("color", [ t[0], t[1], t[2], 0 ]);
|
|
1188
1199
|
}
|
|
1189
|
-
})
|
|
1200
|
+
});
|
|
1190
1201
|
}
|
|
1191
1202
|
reset() {
|
|
1192
|
-
if (!this.map || !this.
|
|
1193
|
-
this.
|
|
1194
|
-
const A = this.
|
|
1195
|
-
s.scale(A, A, -1), this.TransformHelper.updateMatrix(this.map, this.
|
|
1203
|
+
if (!this.map || !this.v) return;
|
|
1204
|
+
this.v.setTranslation(this.v.originTrans), this.v.setRotation(this.W), this.v.setScale(this.q);
|
|
1205
|
+
const A = m(this.map, this.v.getTranslation());
|
|
1206
|
+
s.scale(A, A, -1), this.TransformHelper.updateMatrix(this.map, this.v, 0, 1, [ 0, 0, 0 ]);
|
|
1196
1207
|
}
|
|
1197
|
-
|
|
1198
|
-
const e = this.
|
|
1208
|
+
R(A, t) {
|
|
1209
|
+
const e = this.G(), s = i.set(R, t[0] - e[0], t[1] - e[1]), n = i.set(G, A[0] - e[0], A[1] - e[1]), o = Math.atan2(s[1], s[0]);
|
|
1199
1210
|
return (Math.atan2(n[1], n[0]) - o) / Math.PI * 180;
|
|
1200
1211
|
}
|
|
1201
|
-
|
|
1202
|
-
return this.
|
|
1203
|
-
this.
|
|
1212
|
+
V(A) {
|
|
1213
|
+
return this.S = 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",
|
|
1214
|
+
this.S;
|
|
1204
1215
|
}
|
|
1205
1216
|
transform(A) {
|
|
1206
1217
|
if (this.layerRenderer && this.layerRenderer.layer && (this.layerRenderer.layer.off("renderend", this.render),
|
|
1207
|
-
this.layerRenderer.layer.off("resizeCanvas", this
|
|
1208
|
-
delete this.
|
|
1218
|
+
this.layerRenderer.layer.off("resizeCanvas", this.X)), this.v && (this.v.off("remove", this.$, this),
|
|
1219
|
+
delete this.v), this.v = A, this.v.on("remove", this.$, this), !this.map) return void console.error("should add to a target first");
|
|
1209
1220
|
const t = this.map;
|
|
1210
|
-
this.
|
|
1211
|
-
this.
|
|
1212
|
-
this.
|
|
1221
|
+
this.v.originTrans || (this.v.originTrans = m(t, this.v.getTranslation()), this.v.originRotation = this.v.getRotation(),
|
|
1222
|
+
this.v.originScale = this.v.getScale()), this.TransformHelper.updateMatrix(t, A, 0, 0, [ 0, 0, 0 ]),
|
|
1223
|
+
this.AA(), this.L = !0;
|
|
1213
1224
|
}
|
|
1214
1225
|
getTransformTarget() {
|
|
1215
|
-
return this.
|
|
1226
|
+
return this.v;
|
|
1216
1227
|
}
|
|
1217
|
-
|
|
1218
|
-
delete this.
|
|
1228
|
+
$() {
|
|
1229
|
+
delete this.v;
|
|
1219
1230
|
}
|
|
1220
|
-
|
|
1221
|
-
const A = this.
|
|
1222
|
-
A && (A.off("renderend", this.render), A.off("resizeCanvas", this
|
|
1231
|
+
AA() {
|
|
1232
|
+
const A = this.v.getLayer();
|
|
1233
|
+
A && (A.off("renderend", this.render), A.off("resizeCanvas", this.X));
|
|
1223
1234
|
const t = this.map.getLayers();
|
|
1224
1235
|
let e = null;
|
|
1225
1236
|
for (let A = 0; A < t.length; A++) if (t[A] instanceof n) {
|
|
@@ -1231,37 +1242,37 @@ class R extends(I(r(a))){
|
|
|
1231
1242
|
if (i < 0) return;
|
|
1232
1243
|
s.splice(i, 1), s.push(A);
|
|
1233
1244
|
const o = this.map, I = A.getRenderer();
|
|
1234
|
-
this.layerRenderer = I, this.regl = I.regl, this.renderer = I.renderer, this.
|
|
1235
|
-
this.
|
|
1245
|
+
this.layerRenderer = I, this.regl = I.regl, this.renderer = I.renderer, this.tA = this.layerRenderer.getFBORayPicking(),
|
|
1246
|
+
this.eA = {
|
|
1236
1247
|
projViewMatrix: o.projViewMatrix
|
|
1237
|
-
}, A.on("renderend", this.render, this), A.on("resizeCanvas", this
|
|
1248
|
+
}, A.on("renderend", this.render, this), A.on("resizeCanvas", this.X, this), I.setToRedraw();
|
|
1238
1249
|
}
|
|
1239
|
-
|
|
1240
|
-
this.
|
|
1250
|
+
X() {
|
|
1251
|
+
this.tA.clear(), this.L = !0;
|
|
1241
1252
|
}
|
|
1242
|
-
|
|
1253
|
+
p(A, t, e) {
|
|
1243
1254
|
const s = this.map;
|
|
1244
|
-
if (!(s && this.
|
|
1255
|
+
if (!(s && this.tA && this.layerRenderer && this.layerRenderer.canvas)) return null;
|
|
1245
1256
|
const i = s.getDevicePixelRatio(), n = A.x * i, o = A.y * i, I = {
|
|
1246
1257
|
projViewMatrix: this.map.projViewMatrix,
|
|
1247
1258
|
pointSize: 1
|
|
1248
1259
|
}, r = this.layerRenderer.canvas.gl && this.layerRenderer.canvas.gl.wrap;
|
|
1249
|
-
(this.
|
|
1250
|
-
this.
|
|
1251
|
-
return this.
|
|
1260
|
+
(this.L || r || !this.sA || this.sA !== e) && (this.tA.render(t, I, !0), this.sA = e,
|
|
1261
|
+
this.L = !1);
|
|
1262
|
+
return this.tA.pick(n, o, 10, I, {
|
|
1252
1263
|
viewMatrix: this.map.viewMatrix,
|
|
1253
1264
|
projMatrix: this.map.projMatrix,
|
|
1254
1265
|
returnPoint: !0
|
|
1255
1266
|
});
|
|
1256
1267
|
}
|
|
1257
|
-
|
|
1268
|
+
l() {
|
|
1258
1269
|
const A = this.map.getDevicePixelRatio(), s = {
|
|
1259
1270
|
x: 0,
|
|
1260
1271
|
y: 0,
|
|
1261
1272
|
width: () => this.map ? this.map.width * A : 1,
|
|
1262
1273
|
height: () => this.map ? this.map.height * A : 1
|
|
1263
1274
|
};
|
|
1264
|
-
this.
|
|
1275
|
+
this.iA = new e.MeshShader({
|
|
1265
1276
|
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",
|
|
1266
1277
|
frag: "precision mediump float;\n\nuniform vec4 color;\n\n\n\nvoid main() {\n\n gl_FragColor = color;\n\n}\n\n",
|
|
1267
1278
|
uniforms: [ "color", {
|
|
@@ -1292,18 +1303,18 @@ class R extends(I(r(a))){
|
|
|
1292
1303
|
});
|
|
1293
1304
|
}
|
|
1294
1305
|
render() {
|
|
1295
|
-
if (!this.
|
|
1296
|
-
const A = this.
|
|
1306
|
+
if (!this.M()) return;
|
|
1307
|
+
const A = this.D();
|
|
1297
1308
|
this.helperScene.setMeshes(A);
|
|
1298
1309
|
const t = this.layerRenderer.getFrameContext();
|
|
1299
1310
|
if (t && t.renderTarget && this.layerRenderer.getFrameTimestamp() !== t.timestamp) return;
|
|
1300
|
-
this.
|
|
1311
|
+
this.H(), this.iA.filter = t && t.sceneFilter;
|
|
1301
1312
|
const e = t && t.renderTarget && t.renderTarget.fbo;
|
|
1302
|
-
this.renderer.render(this.
|
|
1313
|
+
this.renderer.render(this.iA, this.eA, this.helperScene, e);
|
|
1303
1314
|
}
|
|
1304
|
-
|
|
1315
|
+
D() {
|
|
1305
1316
|
let A = [];
|
|
1306
|
-
const t = this.TransformHelper.getMeshes(this.
|
|
1317
|
+
const t = this.TransformHelper.getMeshes(this.o);
|
|
1307
1318
|
for (const e in t) {
|
|
1308
1319
|
if ("translate" === e) continue;
|
|
1309
1320
|
const s = t[e];
|
|
@@ -1313,16 +1324,16 @@ class R extends(I(r(a))){
|
|
|
1313
1324
|
for (let t = 0; t < e.length; t++) A = A.concat(e[t]);
|
|
1314
1325
|
return A;
|
|
1315
1326
|
}
|
|
1316
|
-
|
|
1327
|
+
M() {
|
|
1317
1328
|
const A = this.layerRenderer, t = A && A.layer;
|
|
1318
|
-
return A && this.
|
|
1329
|
+
return A && this.v && t && t.isVisible() && this.v.isVisible() && this.regl && this.I;
|
|
1319
1330
|
}
|
|
1320
1331
|
}
|
|
1321
1332
|
|
|
1322
|
-
|
|
1333
|
+
j.mergeOptions({
|
|
1323
1334
|
scaleStrength: 2
|
|
1324
1335
|
});
|
|
1325
1336
|
|
|
1326
|
-
export {
|
|
1337
|
+
export { j as TransformControl };
|
|
1327
1338
|
|
|
1328
|
-
"undefined" != typeof console && console.log("@maptalks/transform-control v0.
|
|
1339
|
+
"undefined" != typeof console && console.log("@maptalks/transform-control v0.82.0");
|