
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
@maptalks/transform-control
Advanced tools
transform-control a plugin to control model's translate、rotation and scale.
npm install @maptalks/transform-control.https://unpkg.com/@maptalks/transform-control/dist/transform-control.js<script type="text/javascript" src="../maptalks.transform-control.js"></script>
<script>
var map = new maptalks.Map("map",{
center : [0, 0],
zoom : 15
});
var transformControl = new maptalks.TransformControl();
transformControl.addTo(map);
transformControl.on('transforming', e => {
//get translate、rotation、scale
const translate = e.translate;
const rotation = e.rotation;
const scale = e.scale;
});
</script>
import TransfromControl from '@maptalks/transform-control';
const map = new maptalks.Map("map",{
center : [0, 0],
zoom : 15
});
const transformControl = new maptalks.TransformControl();
transformControl.addTo(map);
transformControl.on('transforming', e => {
const target = e.target;
target.setTRS(e.translate, e.rotation, e.scale);
});
transformControl.on('positionchange', e => {
const target = e.target;
target.setCoordinates(e.coordinate);
});
(inherited from maptalks.Eventable)transform control's constructor.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | String | transform control's id | |
options | Object | null | construct options |
add the control to a map
| Parameter | Type | Default | Description |
|---|---|---|---|
map | maptalks.Map | a map to add |
returns :
TransformControl: this
remove the control from map
specify a target to transform
| Parameter | Type | Default | Description |
|---|---|---|---|
target | GLTFMarker | Mesh | null | the target to transform |
get the current tranforming target
returns :
Object: the transforming target object
enable the control
returns :
TransformControl: return this
disable the control, when disable the control, it will be not available TransformControl: return this
whether the control is enable Boolean: true or false
when transforming the target, it will trigger transforming event
| Parameter | Type | Default | Description |
|---|---|---|---|
target | GLTFMarker | the target to transform | |
action | String | transforming action, includes xy-translate、x-translate、y-translate、z-translate、z-rotate、scale | |
type | GLTFMarker | event type name | |
translate | Array | current translate when transforming | |
scale | Array | current scale when transforming | |
rotation | Array | current rotation when transforming |
when changing target's position, it will trigger positionchange event
| Parameter | Type | Default | Description |
|---|---|---|---|
target | GLTFMarker | the target to transform | |
action | String | transforming action, includes xy-translate、x-translate、y-translate、z-translate、z-rotate、scale | |
type | GLTFMarker | event type name | |
coordinate | Array | current coordinate when changing target's position |
when endding the transform task, it will trigger transformend event
| Parameter | Type | Default | Description |
|---|---|---|---|
target | GLTFMarker | the target to be transformed | |
action | String | current action | |
type | GLTFMarker | event type name |
FAQs
a plugin to control model's translate、rotation and scale
The npm package @maptalks/transform-control receives a total of 2,164 weekly downloads. As such, @maptalks/transform-control popularity was classified as popular.
We found that @maptalks/transform-control demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.