MarkerStyleConver

new mars2d.MarkerStyleConver(options)

Marker 转换options样式参数处理类

参数名称 类型 描述信息
options Object

参数名称

继承自

方法

static mars2d.MarkerStyleConver.normalizePoint(value) → Array.<Number>|null

规范化锚点参数,支持 Number[]、L.Point;两维都有效才返回

参数名称 类型 描述信息
value Array.<Number> | L.Point

锚点值

返回值:

[x, y] 或 null

static mars2d.MarkerStyleConver.normalizeSize(value) → Array.<Number>|null

规范化尺寸参数,支持 Number、Number[]、L.Point; 返回值的单边可能为 null,表示该边未指定,按内容或图片原始比例自适应

参数名称 类型 描述信息
value Number | Array.<Number> | L.Point

尺寸值

返回值:

[width, height];未指定时返回 null

static mars2d.MarkerStyleConver.resolveIconAnchor(style, iconSize) → Array.<Number>|null

解析图标锚点:显式 iconAnchor 优先;尺寸完整时按 horizontalOrigin/verticalOrigin + offset 计算; 尺寸不完整时返回 null,等运行时实测尺寸后再定位

参数名称 类型 描述信息
style Marker.StyleOptions

样式

iconSize Array.<Number>

已解析的尺寸

返回值:

[x, y] 或 null

static mars2d.MarkerStyleConver.resolveIconSize(style) → Array.<Number>|null

解析样式中的图标尺寸:iconSize 优先,其次 width/height; 只给一边时另一边为 null(由内容或图片原始比例决定,运行时实测补齐)

参数名称 类型 描述信息
style Marker.StyleOptions

样式

返回值:

[width, height] 或 null

static mars2d.MarkerStyleConver.toSizeValue(value) → Number|null

把尺寸值转为有限数字,非法值返回 null

参数名称 类型 描述信息
value *

原始值(可接受数字或数字字符串)

返回值:

有限数字或 null