@maptalks/transform-control 0.117.1 → 0.118.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016-2017 MapTalks
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016-2017 MapTalks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,123 +1,123 @@
1
- # maptalks.TransformControl
2
- [![NPM Version](https://img.shields.io/npm/v/@maptalks/transform-control.svg)](https://github.com/fuzhenn/transform-control.git)
3
- ## Usage
4
-
5
- ```transform-control``` a plugin to control model's translate、rotation and scale.
6
-
7
- ## Install
8
-
9
- * Install with npm: ```npm install @maptalks/transform-control```.
10
- * Use unpkg CDN: ```https://unpkg.com/@maptalks/transform-control/dist/transform-control.js```
11
-
12
- ## Vanilla Javascript
13
- ```html
14
- <script type="text/javascript" src="../maptalks.transform-control.js"></script>
15
- <script>
16
- var map = new maptalks.Map("map",{
17
- center : [0, 0],
18
- zoom : 15
19
- });
20
- var transformControl = new maptalks.TransformControl();
21
- transformControl.addTo(map);
22
- transformControl.on('transforming', e => {
23
- //get translate、rotation、scale
24
- const translate = e.translate;
25
- const rotation = e.rotation;
26
- const scale = e.scale;
27
- });
28
- </script>
29
- ```
30
-
31
- ## ES6
32
-
33
- ```javascript
34
- import TransfromControl from '@maptalks/transform-control';
35
-
36
- const map = new maptalks.Map("map",{
37
- center : [0, 0],
38
- zoom : 15
39
- });
40
- const transformControl = new maptalks.TransformControl();
41
- transformControl.addTo(map);
42
- transformControl.on('transforming', e => {
43
- const target = e.target;
44
- target.setTRS(e.translate, e.rotation, e.scale);
45
- });
46
- transformControl.on('positionchange', e => {
47
- const target = e.target;
48
- target.setCoordinates(e.coordinate);
49
- });
50
- ```
51
-
52
- ## API
53
- * ### Class : TransformControl`(inherited from maptalks.Eventable)`
54
- > transform control's constructor.
55
-
56
- #### Method : new TransformControl(options)
57
- | Parameter | Type | Default | Description|
58
- | ------------- |---------- |-------------|--------- |
59
- | `id` | String | | transform control's id |
60
- | `options` | Object | null | construct options |
61
-
62
- #### Method : addTo(map)
63
- _add the control to a map_
64
- | Parameter | Type | Default | Description|
65
- | ------------- |---------- |-------------|--------- |
66
- | `map` | maptalks.Map | | a map to add |
67
- > returns : <br>
68
- TransformControl: this
69
-
70
- #### Method : remove()
71
- _remove the control from map_
72
-
73
- #### Method : transform(target)
74
- _specify a target to transform_
75
- | Parameter | Type | Default | Description|
76
- | ------------- |---------- |-------------|--------- |
77
- | `target` | GLTFMarker \| Mesh | null | the target to transform |
78
-
79
- #### Method : getTransformTarget()
80
- _get the current tranforming target_
81
- > returns : <br>
82
- Object: the transforming target object
83
-
84
- #### Method : enable()
85
- _enable the control_
86
- > returns : <br>
87
- TransformControl: return this
88
-
89
- #### Method : disable()
90
- _disable the control, when disable the control, it will be not available_
91
- TransformControl: return this
92
-
93
- #### Method : isEnbale()
94
- _whether the control is enable_
95
- Boolean: true or false
96
-
97
- #### Event : transforming
98
- _when transforming the target, it will trigger transforming event_
99
- | Parameter | Type | Default | Description|
100
- | ------------- |---------- |-------------|--------- |
101
- | `target` | GLTFMarker | | the target to transform |
102
- | `action` | String | | transforming action, includes `xy-translate`、`x-translate`、`y-translate`、`z-translate`、`z-rotate`、`scale` |
103
- | `type` | GLTFMarker | | event type name |
104
- | `translate` | Array | | current translate when transforming |
105
- | `scale` | Array | | current scale when transforming |
106
- | `rotation` | Array | | current rotation when transforming |
107
-
108
- #### Event : positionchange
109
- _when changing target's position, it will trigger positionchange event_
110
- | Parameter | Type | Default | Description|
111
- | ------------- |---------- |-------------|--------- |
112
- | `target` | GLTFMarker | | the target to transform |
113
- | `action` | String | | transforming action, includes `xy-translate`、`x-translate`、`y-translate`、`z-translate`、`z-rotate`、`scale` |
114
- | `type` | GLTFMarker | | event type name |
115
- | `coordinate` | Array | | current coordinate when changing target's position |
116
-
117
- #### Event : transformend
118
- _when endding the transform task, it will trigger transformend event_
119
- | Parameter | Type | Default | Description|
120
- | ------------- |---------- |-------------|--------- |
121
- | `target` | GLTFMarker | | the target to be transformed |
122
- | `action` | String | | current action |
123
- | `type` | GLTFMarker | | event type name |
1
+ # maptalks.TransformControl
2
+ [![NPM Version](https://img.shields.io/npm/v/@maptalks/transform-control.svg)](https://github.com/fuzhenn/transform-control.git)
3
+ ## Usage
4
+
5
+ ```transform-control``` a plugin to control model's translate、rotation and scale.
6
+
7
+ ## Install
8
+
9
+ * Install with npm: ```npm install @maptalks/transform-control```.
10
+ * Use unpkg CDN: ```https://unpkg.com/@maptalks/transform-control/dist/transform-control.js```
11
+
12
+ ## Vanilla Javascript
13
+ ```html
14
+ <script type="text/javascript" src="../maptalks.transform-control.js"></script>
15
+ <script>
16
+ var map = new maptalks.Map("map",{
17
+ center : [0, 0],
18
+ zoom : 15
19
+ });
20
+ var transformControl = new maptalks.TransformControl();
21
+ transformControl.addTo(map);
22
+ transformControl.on('transforming', e => {
23
+ //get translate、rotation、scale
24
+ const translate = e.translate;
25
+ const rotation = e.rotation;
26
+ const scale = e.scale;
27
+ });
28
+ </script>
29
+ ```
30
+
31
+ ## ES6
32
+
33
+ ```javascript
34
+ import TransfromControl from '@maptalks/transform-control';
35
+
36
+ const map = new maptalks.Map("map",{
37
+ center : [0, 0],
38
+ zoom : 15
39
+ });
40
+ const transformControl = new maptalks.TransformControl();
41
+ transformControl.addTo(map);
42
+ transformControl.on('transforming', e => {
43
+ const target = e.target;
44
+ target.setTRS(e.translate, e.rotation, e.scale);
45
+ });
46
+ transformControl.on('positionchange', e => {
47
+ const target = e.target;
48
+ target.setCoordinates(e.coordinate);
49
+ });
50
+ ```
51
+
52
+ ## API
53
+ * ### Class : TransformControl`(inherited from maptalks.Eventable)`
54
+ > transform control's constructor.
55
+
56
+ #### Method : new TransformControl(options)
57
+ | Parameter | Type | Default | Description|
58
+ | ------------- |---------- |-------------|--------- |
59
+ | `id` | String | | transform control's id |
60
+ | `options` | Object | null | construct options |
61
+
62
+ #### Method : addTo(map)
63
+ _add the control to a map_
64
+ | Parameter | Type | Default | Description|
65
+ | ------------- |---------- |-------------|--------- |
66
+ | `map` | maptalks.Map | | a map to add |
67
+ > returns : <br>
68
+ TransformControl: this
69
+
70
+ #### Method : remove()
71
+ _remove the control from map_
72
+
73
+ #### Method : transform(target)
74
+ _specify a target to transform_
75
+ | Parameter | Type | Default | Description|
76
+ | ------------- |---------- |-------------|--------- |
77
+ | `target` | GLTFMarker \| Mesh | null | the target to transform |
78
+
79
+ #### Method : getTransformTarget()
80
+ _get the current tranforming target_
81
+ > returns : <br>
82
+ Object: the transforming target object
83
+
84
+ #### Method : enable()
85
+ _enable the control_
86
+ > returns : <br>
87
+ TransformControl: return this
88
+
89
+ #### Method : disable()
90
+ _disable the control, when disable the control, it will be not available_
91
+ TransformControl: return this
92
+
93
+ #### Method : isEnbale()
94
+ _whether the control is enable_
95
+ Boolean: true or false
96
+
97
+ #### Event : transforming
98
+ _when transforming the target, it will trigger transforming event_
99
+ | Parameter | Type | Default | Description|
100
+ | ------------- |---------- |-------------|--------- |
101
+ | `target` | GLTFMarker | | the target to transform |
102
+ | `action` | String | | transforming action, includes `xy-translate`、`x-translate`、`y-translate`、`z-translate`、`z-rotate`、`scale` |
103
+ | `type` | GLTFMarker | | event type name |
104
+ | `translate` | Array | | current translate when transforming |
105
+ | `scale` | Array | | current scale when transforming |
106
+ | `rotation` | Array | | current rotation when transforming |
107
+
108
+ #### Event : positionchange
109
+ _when changing target's position, it will trigger positionchange event_
110
+ | Parameter | Type | Default | Description|
111
+ | ------------- |---------- |-------------|--------- |
112
+ | `target` | GLTFMarker | | the target to transform |
113
+ | `action` | String | | transforming action, includes `xy-translate`、`x-translate`、`y-translate`、`z-translate`、`z-rotate`、`scale` |
114
+ | `type` | GLTFMarker | | event type name |
115
+ | `coordinate` | Array | | current coordinate when changing target's position |
116
+
117
+ #### Event : transformend
118
+ _when endding the transform task, it will trigger transformend event_
119
+ | Parameter | Type | Default | Description|
120
+ | ------------- |---------- |-------------|--------- |
121
+ | `target` | GLTFMarker | | the target to be transformed |
122
+ | `action` | String | | current action |
123
+ | `type` | GLTFMarker | | event type name |
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @maptalks/transform-control v0.117.1
2
+ * @maptalks/transform-control v0.118.0
3
3
  * LICENSE : UNLICENSED
4
4
  * (c) 2016-2025 maptalks.org
5
5
  */
@@ -1835,8 +1835,8 @@ class IA extends(r(a(C))){
1835
1835
  height: () => this.map ? this.map.height * A : 1
1836
1836
  };
1837
1837
  this.bA = new t.MeshShader({
1838
- 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",
1839
- frag: "precision mediump float;\n\nuniform vec4 color;\n\n\n\nvoid main() {\n\n gl_FragColor = color;\n\n}\n\n",
1838
+ vert: "attribute vec3 aPosition;\nuniform mat4 projViewModelMatrix;\nvoid main()\n{\n gl_Position = projViewModelMatrix * vec4(aPosition, 1.0);\n}\n",
1839
+ frag: "precision mediump float;\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}\n",
1840
1840
  uniforms: [ "color", {
1841
1841
  name: "projViewModelMatrix",
1842
1842
  type: "function",
@@ -1898,5 +1898,5 @@ IA.mergeOptions({
1898
1898
 
1899
1899
  export { IA as TransformControl };
1900
1900
 
1901
- "undefined" != typeof console && console.log("@maptalks/transform-control v0.117.1");
1901
+ "undefined" != typeof console && console.log("@maptalks/transform-control v0.118.0");
1902
1902
  //# sourceMappingURL=transform-control.es.js.map