H.map.Icon
类包含hitArea
选项,我认为该选项适用于调整图标或标记的选择区域容差。不幸的是,文档有点稀疏,以下是抛出异常:
var marker = new H.map.Marker(location, { icon: new H.map.Icon("/Content/images/anchordot.png", {
size: { w: 20, h: 20 },
anchor: { x: 10, y: 10 },
hitArea: new H.map.HitArea(H.map.HitArea.ShapeType.CIRCLE, [20]) }) });
我真的不知道HitArea
构造函数的可选第二个参数是什么,但是我得到一个带或不带该参数的异常。该例外的细节根本没有帮助。
想法?
答案 0 :(得分:0)
您将错误数量的参数传递给数组。对于圆,我们需要三个参数-坐标和半径。因此,您的示例应如下所示。祝您编码愉快!
var marker = new H.map.Marker(location, { icon: new H.map.Icon("/Content/images/anchordot.png", {
size: { w: 20, h: 20 },
anchor: { x: 10, y: 10 },
hitArea: new H.map.HitArea(H.map.HitArea.ShapeType.CIRCLE, [0,0,20]) }) });