Skip to content

GLTFMarker

GLTFMarker是Marker的子类,用于在指定地理坐标上添加GLTF模型和进行交互。

GLTFMarker能够用symbol设置模型的状态,例如缩放比例,透明度,旋转角度等,同时提供了方法用于更新模型,更新模型状态,开启暂停动画等。

注:2026 源码确认继承关系为 class GLTFMarker extends Marker(maptalks.Marker,自带事件、infoWindow 等能力)(2026 核对)

构造函数

js
import { GLTFMarker } from '@maptalks/gl-layers';

const gltfMarker = new GLTFMarker([0, 0], {
  symbol: {
    url: 'path/to/gltf.gltf'
  }
});
详细信息
参数:
  • coordinates* Number[] 坐标
  • options* Object 配置参数,可选的配置项如下:
配置名类型描述默认值
symbolObject样式配置,symbol 字段见下方"样式说明"null

注(2026 源码核对):旧版 fitSize 选项在 2026 源码中已移除,模型尺寸改用 symbol.modelHeight / symbol.markerPixelHeight 控制。

|id | Object | 样式配置 | null | |visible | Boolean | 是否显示 | true | |interactive | Boolean | 是否能够交互 | true | |editable | Boolean | 是否允许编辑 | true | |cursor | String | 鼠标样式 | null | |draggable | Boolean | 是否允许拖拽 | false | |dragOnAxis | String | 是否沿x轴或者y轴拖拽,可选的值为"x"或者"y" | null | |zIndex | Number | 初始的zIndex,决定了绘制顺序 | null |

样式说明

GLTFMarker的options.symbol中包含以下的设置和属性。

配置名类型描述默认值
urlString模型的url,不设置时使用内置模型pyramid'pyramid'
visibleBoolean模型是否可见true
translationNumber[]模型在本地坐标系xyz轴上的偏移量[0, 0, 0]
translationX / Y / ZNumber模型在本地坐标系单轴上的偏移量(2026 源码补充)0
rotationNumber[]模型在本地坐标系xyz轴上的旋转角度,单位角度[0, 0, 0]
rotationX / Y / ZNumber模型在本地坐标系单轴上的旋转角度(2026 源码补充)0
scaleNumber[]模型在本地坐标系xyz轴上的缩放倍数[1, 1, 1]
scaleX / Y / ZNumber模型在本地坐标系单轴上的缩放倍数(2026 源码补充)1
modelHeightNumber按模型高度(米)自适应缩放(2026 源码补充)
markerPixelHeightNumber固定模型的像素高度,设置后不再随地图缩放改变(2026 源码补充)
animationBoolean是否开启动画(需模型含动画数据)false
animationNameString/Number动画序列名称0
loopBoolean是否开启动画循环false
speedNumber动画速度倍数1
anchorZString模型在z轴上的锚点或对齐点,可选的值: center, top, bottomcenter
shadowBoolean是否开启阴影true
bloomBoolean是否开启泛光false
doubleSidedBoolean是否双面渲染(2026 源码补充)false
animationNodesNumber[]限定动画作用的节点索引数组(2026 源码补充)null
shaderString模型绘制的shader,可选值:pbr, pbr-lite, phong, wireframepbr
uniformsObject选择的shader的材质参数,具体参数说明可以参考这篇文档。null

注(2026 源码核对):symbol 在源码中没有默认值对象,animation/loop 需显式设置才会生效;模型透明度通过 uniforms.polygonOpacity(pbr/phong)或 uniforms.lineOpacity(wireframe)控制;旧版 fixSizeOnZoom 选项已移除,改用 modelHeight / markerPixelHeight

symbol 字段核对(2026 源码)

  • 上表字段均有效;url 默认值为 'pyramid'(内置模型)
  • 2026 源码还支持:modelHeight(按模型高度自适应缩放,单位米)、markerPixelHeight(固定像素高度)、translationX/Y/ZrotationX/Y/ZscaleX/Y/Z(单轴设置)、anchorZ 的可取值扩展为 'center' | 'bottom' | 'top'doubleSided(双面渲染)、animationNodes(限定动画节点)
  • 模型透明度通过 uniforms.polygonOpacity(pbr/phong)或 uniforms.lineOpacity(wireframe)控制,symbol.opacity 不存在于 2026 源码(2026 核对)

成员函数

setUrl(url)

更新模型的url。

返回:

  • this
getUrl()

获取模型的url。

返回:

  • String
setBloom(isBloom)

设置模型是否开启泛光。

参数:

  • isBloom Boolean 是否泛光

返回:

  • this
isBloom()

返回模型是否开启泛光。

返回:

  • Boolean
setCastShadow(isCastShadow)

设置模型是否开启阴影。

参数:

  • isCastShadow Boolean 是否开启阴影

返回:

  • this
isCastShadow()

返回模型是否开启阴影。

返回:

  • Boolean
outline()

高亮模型。

因为高亮是采用后处理实现的,图层需要加入GroupGLLayer,且outline后处理是开启的。

js
gltfMarker.outline();

返回:

  • this
cancelOutline()

取消高亮。

返回:

  • this
isOutline()

模型是否高亮。

返回:

  • Boolean
setShader(shader)

设置模型绘制的shader。

参数:

  • shader String 可选的shader: pbr, phong, wireframe, 默认是pbr

返回:

  • this
getShader()

返回模型的绘制shader。

返回:

  • String
setUniforms(uniforms)

设置模型的 symbol.uniforms

参数:

  • uniforms Object 设置symbol.uniforms值

返回:

  • this
getUniform(key)

返回模型symbol.uniforms中的属性值。

参数:

  • key String uniform属性名

返回:

  • any
setUniform(key, value, nodeIndex)

设置模型的symbol.uniforms中的单个属性值,可指定nodeIndex将uniform只应用到指定节点(2026 源码补充)。

参数:

  • key String uniform属性名
  • value any 属性值
  • nodeIndex Number 可选的节点序号

返回:

  • this
getUniforms()

返回模型的symbol.uniforms对象(2026 源码补充)。

返回:

  • Object
setAnimation(isAnimated)

设置模型是否开启动画,默认开启。

参数:

  • isAnimated Boolean 是否开启动画。

返回:

  • this
isAnimated()

返回模型是否开启了动画。

返回:

  • Boolean
isDashAnimated()

返回模型在wireframe shader绘制时,是否开启了dash动画。

返回:

  • Boolean
setAnimationLoop(looped)

设置模型是否开启循环动画,默认开启。

参数:

  • looped Boolean 是否开启循环动画。

返回:

  • this
isAnimationLooped()

返回图形是否开启了动画循环。

返回:

  • Boolean
setAnimationSpeed(speed)

设置模型的动画速度。

参数:

  • speed Number 模型速度,为原始速度的倍数,默认为1。

返回:

  • this
getAnimationSpeed()

返回模型的动画速度。

返回:

  • Number
getAnimations()

获取模型中所以后的动画序列名称。

返回:

  • String|Number[]
getCurrentAnimation()

获取模型当前的动画序列名称。

返回:

  • String|Number
setCurrentAnimation(animationName)

设置模型当前的动画序列名称。

参数:

  • animationName String|Number 动画序列名称

返回:

  • this
setAnimationTimeframe(timestamp)

设置当前动画的时间片。

参数:

  • timestamp Number 动画时间片,单位ms

返回:

  • this
setTranslation(translationX, translationY, translationZ)

设置模型在模型本地坐标系中的偏移量。

参数:

  • translationX Number 本地坐标系x轴偏移量
  • translationY Number 本地坐标系y轴偏移量
  • translationZ Number 本地坐标系z轴偏移量

返回:

  • this
getTranslation()

获取模型的偏移量

返回:

  • Number[] 三位数组
setRotation(rotationX, rotationY, rotationZ)

rotationX,rotationY,rotationZ分别是模型在本地坐标系x,y,z轴上的旋转角度值。

参数:

  • rotationX Number 模型在本地坐标系x轴上的旋转角度值
  • rotationY Number 模型在本地坐标系y轴上的旋转角度值
  • rotationZ Number 模型在本地坐标系z轴上的旋转角度值

返回:

  • this
getRotation()

获取模型的旋转值。

返回:

  • Number[] 三位数组
setScale(scaleX, scaleY, scaleZ)

scaleX,scaleY,scaleZ分别是模型在本地坐标系x,y,z轴上的缩放倍数。

参数:

  • scaleX Number 模型在本地坐标系x轴上的缩放倍数
  • scaleY Number 模型在本地坐标系y轴上的缩放倍数
  • scaleZ Number 模型在本地坐标系z轴上的缩放倍数

返回:

  • this
getScale()

获取模型的缩放倍数。

返回:

  • Number[] 三位数组
setTRS(translation, rotation, scale)

设置模型的translation,rotation和scale。

translation是模型本地坐标中的三位数组偏移量。 rotation是三位数组,模型在本地坐标系x,y,z轴上的旋转角度值。 scale是三位数组,模型在本地坐标系x,y,z轴上的缩放倍数。

参数:

  • translation Number[] 三位数组,本地坐标系中的偏移量。
  • rotation Number[] 三位数组,模型在本地坐标系x,y,z轴上的旋转角度值。
  • scale Number[] 三位数组,模型在本地坐标系x,y,z轴上的缩放倍数。

返回:

  • this
setModelMatrix(modelMatrix)

设置模型的本地变换矩阵,矩阵会被拆分为translation, rotation, scale。

参数:

  • modelMatrix Number[] 16位数组变换矩阵

返回:

  • this
getModelMatrix()

获取模型在本地坐标上的16位数组,变换矩阵。

返回:

  • Number[]
setAnchorZ(anchorZ)

设置模型在z轴上的锚点或者对齐点,对齐顶部还是对齐底部。

参数:

  • anchorZ String z轴锚点,可选的值为 center 或者 top 或者 bottom(2026 源码核对,未设置时模型中心与坐标对齐)

返回:

  • this
getAnchorZ()

获取模型在z轴上的锚点。

返回:

  • String

继承自Marker的方法

getCoordinates()

获取坐标。

返回:

  • Coordinate
setCoordinates(coordinates)

设置坐标。

参数:

  • coordinates Number[] | Coordinate 新的坐标

返回:

  • this
getFirstCoordinate()

获取第一个坐标。

返回:

  • Coordinate
getLastCoordinate()

获取最后一个坐标。

返回:

  • Coordinate
addTo(layer)

添加到图层上。

参数:

  • layer Layer 图层

返回:

  • this
getLayer()

获取添加到的图层。

返回:

  • Layer
getMap()

获取添加到的地图。

返回:

  • Map
getId()

获取Geometry的id。

返回:

  • String | Number
setId(id)

设置新的id。

参数:

  • id Number | String 新的id

返回:

  • this
getProperties()

获取Geometry的属性数据。

返回:

  • Object
setProperties(properties)

给Geometry设置属性数据。

参数:

  • properties Object 新的属性数据

返回:

  • this
getType()

获取Geometry的type。

返回:

  • String
getSymbol()

获取Geometry的symbol样式。

返回:

  • Object
setSymbol(symbol)

给Geometry设置新的symbol样式。

参数:

  • symbol Object 新的样式对象

返回:

  • Object
updateSymbol(symbol)

更新Geometry的symbol样式。

参数:

  • symbol Object 要更新的symbol属性

返回:

  • Object
getCenter()

获取Geometry的地理重心。

返回:

  • Coordinate
getExtent()

获取Geometry的地理范围。

返回:

  • Extent
show()

显示Geometry。

返回:

  • this
hide()

隐藏Geometry。

返回:

  • this
isVisible()

Geometry是否显示。

返回:

  • Boolean
getZIndex()

返回Geometry的zIndex。

返回:

  • Number
setZIndex(zIndex)

设置Geometry的zIndex。

参数:

  • zIndex Number Geometry的zIndex

返回:

  • this
setZIndexSilently(zIndex)

只设置Geometry的zIndex,但不会触发图层的重绘。 如果有大量Geoemtry的zIndex要更新,可以调用setZIndexSilently来更新,在最后一个Geometry调用setZIndex来出发图层的重绘,这样能提升性能。

参数:

  • zIndex Number Geometry的zIndex

返回:

  • this
translate(x, y)

用给定的x和y偏移量移动Geometry。

参数:

  • x Number x轴上的偏移量
  • y Number y轴上的偏移量

返回:

  • this
flash(interval, count, cb, context)

按照给定的参数间隔消失,显示,闪动Geometry。

参数:

  • interval Number 间隔时间
  • count Number 次数
  • cb Function 闪烁结束后的回调函数
  • context Object 回调函数运行时使用的this值

返回:

  • this
copy()

复制一个Geometry。

返回:

  • Geometry
remove()

从图层上移除Geometry。

返回:

  • this
toGeoJSONGeometry()

转换成GeoJSON的geometry对象。

返回:

  • Object
toGeoJSON(options)

转换成GeoJSON的对象。

参数:

  • options Object 导出配置
  • options.geometry Boolean 是否导出geometry,默认是true
  • options.properties Boolean 是否导出properties,默认是true

返回:

  • Object
toJSON(options)

转换成JSON对象。

该对象可以用 Geometry.fromJSON(json) 创建一个Geometry对象。

参数:

  • options Object 导出配置
  • options.geometry Boolean 是否导出geometry,默认是true
  • options.properties Boolean 是否导出properties,默认是true
  • options.options Boolean 是否导出构造options,默认是true
  • options.symbol Boolean 是否导出symbol,默认是true
  • options.infoWindow Boolean 是否导出InfoWindow设置,默认是true

返回:

  • Object
getLength()

返回Geometry的地理长度。

返回:

  • Number
getArea()

返回Geometry的地理面积。

返回:

  • Number
rotate(angle, pivot)

绕着 pivot 坐标旋转 angle 角度。

参数:

  • angle* Number 渲染角度,单位度
  • pivot Coordinate 渲染中心点

返回:

  • this
startEdit(options)

开始编辑图形。

参数:

  • options Object 编辑参数
  • options.symbol Object 编辑状态的图形样式
  • options.fixAspectRatio Boolean 如果图形有高宽,则固定图形的高宽比
  • options.centerHandleSymbol Object 图形中心拖动手柄的样式(如果存在)
  • options.vertexHandleSymbol Object 端点拖动手柄的样式(如果存在)
  • options.newVertexHandleSymbol Object 新建端点手柄的样式(如果存在)
  • options.centerHandleSymbol Object 图形中心拖动手柄的样式(如果存在)

返回:

  • this
endEdit()

停止编辑。

返回:

  • this
redoEdit()

重做上一步编辑操作。

返回:

  • this
undoEdit()

撤销上一步编辑操作。

返回:

  • this
cancelEdit()

取消编辑,让图形回到最初状态。

返回:

  • this
isEditing()

图形是否处于编辑状态中。

返回:

  • this
isDragging()

图形是否处于拖拽状态中。

返回:

  • this
animate(styles, options, step)

按照给定的参数执行图形动画。

参数:

  • styles* Object 要执行动画的属性,例如symbol或是translate
  • options Object 动画设置
  • options.duration Number 持续时间,单位ms,默认1000
  • options.startTime Number 开始动画的时间
  • options.easing String 动画缓动类型,缓动类型可以参考animation-easings中的说明。
  • options.repeat Boolean 动画结束后是否重复播放

返回:

  • this
setInfoWindow(options)

给图形设置弹出信息框。

参数:

  • options Object 信息框设置
  • options.title String 信息框标题
  • options.content String 信息框内容

其他设置可以参考InfoWindow中的说明和示例

返回:

  • this
getInfoWindow()

返回Geometry的InfoWindow对象实例。

返回:

  • InfoWindow
openInfoWindow(coordinates)

打开图形的信息框。

参数:

  • coordinates Coordiante | Number[] 可选的信息框坐标。

返回:

  • this
closeInfoWindow()

关闭InfoWindow信息框。

返回:

  • this
removeInfoWindow()

移除图形的InfoWindow信息框。

返回:

  • this
setMenu(options)

给图形设置右键菜单。

参数:

  • options Object 菜单设置
  • options.width Number 菜单宽度
  • options.items Object[] 菜单项
  • options.items.item String 菜单显示标题
  • options.items.click Function 响应函数

其他设置可以参考Menu中的说明和示例

返回:

  • this
openMenu(coordinates)

打开图形的右键菜单。

参数:

  • coordinates Coordiante | Number[] 可选的菜单坐标。

返回:

  • this
setMenuItems(items)

给图形设置右键菜单中的菜单项。

参数:

  • items Object[] 菜单项
  • items.item String 菜单显示标题
  • items.click Function 响应函数

返回:

  • this
getMenuItems()

返回图形的右键菜单的菜单项。

返回:

  • Object[]
closeMenu()

关闭右键菜单。

返回:

  • this
removeMenu()

移除右键菜单。

返回:

  • this
on(events, handler, context)

注册图形的监听事件

返回:

  • this
addEventListener(events, handler, context)

同 on 方法

返回:

  • this
once(events, handler, context)

注册图形的监听事件,响应后即删除

返回:

  • this
off(events, handler, context)

移除图形注册的监听事件

返回:

  • this
removeEventListener(events, handler, context)

同 off 方法

返回:

  • this
listens(events, handler, context)

判断图形是否监听了events事件。

返回:

  • Boolean
fire(event, params)

手动发射一个事件,params是时间参数。

返回:

  • this
setOptions(options)

设置图形配置。

返回:

  • this
config(key, value)

更新某个图形配置。

返回:

  • this
getJSONType()

返回图形类注册的JSON type。

返回:

  • String

方法核对(2026 源码)

旧版文档未收录、但 2026 源码中提供的方法:

  • setUniform(key, value, nodeIndex?) / getUniforms():按 key 设置 / 批量读取材质 uniform
  • setModelHeight(h) / getModelHeight():按模型高度(米)自适应缩放
  • cancelMarkerPixelHeight():取消固定像素高度,恢复按需缩放
  • getCurrentPixelHeight():模型当前像素高度
  • rotateAround(coordinate, degree):绕给定坐标旋转
  • highlight({color, opacity, bloom}) / highlightNodes([{nodeIndex, ...}]) / cancelHighlight(nodes?):高亮整个模型 / 高亮指定节点 / 取消高亮
  • outlineNodes(nodes) / cancelOutline(nodes?):指定节点描边 / 取消描边
  • getBoundingBox() / getBoundingBoxCenter() / getBoundingBoxWidth(axis):模型包围盒相关(注意 YZ 轴翻转换算)
  • getGLTFJSON() / getGLTFBBox() / getAllMeshes():获取 gltf 原始 JSON / 模型包围盒 / 所有 mesh
  • showBoundingBox(options?) / hideBoundingBox():显示 / 隐藏模型包围盒辅助线
  • setNodeTRS(nodeIndex, trs={translation, rotation, scale}):设置 gltf 指定节点的平移/旋转/缩放
  • zoomTo(options={animation: true}, step?):缩放到模型包围盒(zoomAt(index, ...) 为 MultiGLTFMarker 方法,见 MultiGLTFMarker
  • getCenter():模型几何中心坐标(含平移偏移)
  • isLoaded():模型是否加载完成
  • copy() / remove():深拷贝 / 移除并释放模型资源(mesh、纹理、jointTexture)

静态方法

registerJSONType(type)

注册一个Geometry JSON类型。

参数:

  • type String Geometry类型
getJSONClass(type)

返回type这个JSON type对应的图形类。

参数:

  • type String Geometry类型

返回:

  • Geometry子类

静态方法补充(2026 源码)

  • static getGLTFAnchorsAlongLineString(coordinates, bboxWidth, map, options):沿线生成批量模型锚点(options: gapLength / count / rotateAlongLine / snapToEndVertexes / scaleEndModel)
  • static combineGLTFBoundingBox(markers): {min, max}:合并多个 marker 的包围盒

事件

图层事件监听示例代码:

js
// 监听workerready事件
layer.once('workerready', e => {
  // e为事件参数
  console.log('worker is ready');
});

// 监听tileload事件
layer.on('tileload', e => {
  // e为事件参数
  console.log('loaded a tile', e.tile);
});

图形事件

add

GLTFMarker添加到图层的事件。

参数属性:

属性名类型
typeString"add"
targetGLTFMarkerthis
layerGLTFLayerGLTF图层
load

GLTFMarker的模型载入事件。

参数属性:

属性名类型
typeString"load"
targetGLTFMarkerthis
dataObjectGLTF模型

继承自Geometry的事件

mousedown

mousedown事件。

参数属性:

属性名类型
typeString"mousedown"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
mouseup

mouseup事件。

参数属性:

属性名类型
typeString"mouseup"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
mousemove

mousemove事件。

参数属性:

属性名类型
typeString"mousemove"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
click

click事件。

参数属性:

属性名类型
typeString"click"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
dblclick

dblclick事件。

参数属性:

属性名类型
typeString"dblclick"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
contextmenu

contextmenu事件。

参数属性:

属性名类型
typeString"contextmenu"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
touchstart

touchstart事件。

参数属性:

属性名类型
typeString"touchstart"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
touchmove

touchmove事件。

参数属性:

属性名类型
typeString"touchmove"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
touchend

touchend事件。

参数属性:

属性名类型
typeString"touchend"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
mouseenter

mouseenter事件。

参数属性:

属性名类型
typeString"mouseenter"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
mouseover

mouseover事件。

参数属性:

属性名类型
typeString"mouseover"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
mouseout

mouseout事件。

参数属性:

属性名类型
typeString"mouseout"
targetGeoemtrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
idchange

图形id变化事件。

参数属性:

属性名类型
typeString"idchange"
targetGeometrythis
oldString旧的id
newString新的id
propertieschange

图形属性数据变化事件。

参数属性:

属性名类型
typeString"propertieschange"
targetGeometrythis
oldString旧的id
newString新的id
show

图形显示事件。

参数属性:

属性名类型
typeString"show"
targetGeometrythis
hide

图形隐藏事件。

参数属性:

属性名类型
typeString"hide"
targetGeometrythis
zindexchange

图形zIndex变化事件。

参数属性:

属性名类型
typeString"zindexchange"
targetGeometrythis
oldString旧的zIndex
newString新的zIndex
removestart

图形开始移除事件。

参数属性:

属性名类型
typeString"removestart"
targetGeometrythis
removeend

图形移除结束事件。

参数属性:

属性名类型
typeString"removeend"
targetGeometrythis
remove

图形移除事件,它在 removeend 后抛。

参数属性:

属性名类型
typeString"remove"
targetGeometrythis
shapechange

图形shape发生变化时,例如增加删除新的端点,修改某个端点位置时。

参数属性:

属性名类型
typeString"shapechange"
targetGeometrythis
positionchange

图形position发生变化时,即整体移动,但形状不变时。

参数属性:

属性名类型
typeString"positionchange"
targetGeometrythis
symbolchange

图形的symbol变化事件。

参数属性:

属性名类型
typeString"symbolchange"
targetGeometrythis
propertiesObjectsymbol属性
editstart

编辑开始事件。

参数属性:

属性名类型
typeString"editstart"
targetGeometrythis
editend

编辑结束事件。

参数属性:

属性名类型
typeString"editend"
targetGeometrythis
canceledit

取消编辑事件。

参数属性:

属性名类型
typeString"canceledit"
targetGeometrythis
redoedit

重做编辑事件。

参数属性:

属性名类型
typeString"redoedit"
targetGeometrythis
undoedit

撤销编辑事件。

参数属性:

属性名类型
typeString"undoedit"
targetGeometrythis
dragstart

拖拽开始事件。

参数属性:

属性名类型
typeString"dragstart"
targetGeometrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
dragging

正在拖拽事件。

参数属性:

属性名类型
typeString"dragging"
targetGeometrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
dragend

拖拽结束事件。

参数属性:

属性名类型
typeString"dragend"
targetGeometrythis
coordinateCoordinate事件坐标
containerPointPoint事件容器坐标
viewPointPoint事件容器相对坐标
domEventeventdom事件
animatestart

动画开始事件。

参数属性:

属性名类型
typeString"animatestart"
targetGeometrythis
animating

动画正在进行事件。

参数属性:

属性名类型
typeString"animating"
targetGeometrythis
animateend

动画结束事件。

参数属性:

属性名类型
typeString"animateend"
targetGeometrythis
handledragstart

编辑手柄的拖动开始事件。

参数属性:

属性名类型
typeString"handledragstart"
targetGeometrythis
handledragging

编辑手柄的正在拖动事件。

参数属性:

属性名类型
typeString"handledragging"
targetGeometrythis
handledragend

编辑手柄的拖动结束事件。

参数属性:

属性名类型
typeString"handledragend"
targetGeometrythis
editrecord

有编辑产生,并记录到编辑历史中的事件。

参数属性:

属性名类型
typeString"editrecord"
targetGeometrythis
add

图形被添加到图层上的事件

参数属性:

属性名类型
typeString"add"
targetGeometrythis

事件补充(2026 源码核对)

  • meshcreate:网格创建完成(在 marker 上触发,图层通过 geometry 事件同步接收)
  • modelerror:模型加载出错
  • positionchange:坐标变化

本文档已与 @maptalks/gl-layers 2026 源码核对(api-notes-others.md)