
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
leaflet.trackmarker
Advanced tools
A Leaflet plugin for animated moving markers along a path with rotation support.
A lightweight Leaflet plugin for animated markers that move along a path with automatic rotation.
让你的 Marker 沿路线自动移动,并智能旋转方向!

play(), pause(), seek(0.5), reset()npm install leaflet.trackmarker @turf/turf
⚠️ 注意:
@turf/turf是运行时依赖,用于路径计算。
<!-- 必须先加载 Leaflet -->
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/@turf/turf@7.0.0/turf.min.js"></script>
<!-- 加载 TrackMarker 插件 -->
<script src="https://unpkg.com/leaflet.trackmarker@latest/dist/index.umd.js"></script>
import L from 'leaflet';
import 'leaflet/dist/leaflet.css';
import 'leaflet.trackmarker';
// 定义路径(经纬度数组)
const route = [
[116.4, 39.9], // 北京
[116.5, 39.95],
[116.6, 39.92],
[116.7, 39.98]
];
let line = L.polyline(route, {
color: "red",
weight: 5,
opacity: 0.5,
});
line.addTo(map);
// 创建可移动的 Marker
const marker = L.trackMarker(line, {
speed: 0.005, // 速度:5 米/秒
rotation: true, // 启用自动旋转
autoPlay: true, // 自动开始
rotationOffset: -90, // 图标方向修正(例如:图标默认朝右)
}).addTo(map);
// 控制播放
marker.play();
marker.pause();
marker.seek(0.75); // 跳转到 75% 处
marker.reset(); // 重置到起点
<script>
const route = [
[116.4, 39.9],
[116.5, 39.95],
[116.6, 39.92]
];
let line = L.polyline(route, {
color: "red",
weight: 5,
opacity: 0.5,
});
line.addTo(map);
const marker = L.trackMarker(line, {
speed: 0.005,
rotation: true
}).addTo(map);
marker.play();
</script>
trackMarker(line: L.Polyline, options?: TrackMarkerOptions)创建一个可移动的 TrackMarker。
| 参数 | 类型 | 说明 |
|---|---|---|
line | L.Polyline | 路径图层 |
options | TrackMarkerOptions | 配置选项(见下表) |
TrackMarkerOptions| 选项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
speed | number | 0.1 | 移动速度(km/s) |
autoPlay | boolean | true | 是否自动开始播放 |
rotation | boolean | true | 是否启用自动旋转 |
rotationOffset | number | 0 | 旋转偏移角度 |
onPause | () => void | - | 暂停时的回调 |
onReset | () => void | - | 重置到起点时的回调 |
onFinish | () => void | - | 到达终点时的回调 |
onProgress | () => void | - | 播放过程中持续触发的回调 |
onBeforePlay | () => void | - | 播放前触发的回调 |
onPlay | () => void | - | 播放时触发的回调 |
| 方法 | 说明 |
|---|---|
.play() | 开始或继续播放 |
.pause() | 暂停播放 |
.reset() | 重置到路径起点 |
.seek(percent) | 跳转到路径的百分比位置(0-1) |
.setSpeed(speed) | 动态设置新速度 |
.getTraveled() | 获取已 traveled 的距离 |
.getTotalDistance() | 获取路径的总距离 |
我们提供了一个完整的示例页面,请查看:
或在线预览(发布后可部署到 GitHub Pages)。
欢迎提交 Issue 和 Pull Request!
git clone https://github.com/ngd-b/leaflet.trackmarker.git
cd leaflet.trackmarker
pnpm install
pnpm dev
src/:源码example/:示例页面dist/:构建输出MIT License
📌 让地图上的标记“活”起来!
Built with ❤️ for GIS developers.
FAQs
A Leaflet plugin for animated moving markers along a path with rotation support.
The npm package leaflet.trackmarker receives a total of 0 weekly downloads. As such, leaflet.trackmarker popularity was classified as not popular.
We found that leaflet.trackmarker 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.