gpt4 book ai didi

javascript - 尝试构造 HERE map HitArea 对象时发生异常

转载 作者:行者123 更新时间:2023-11-28 05:14:43 25 4
gpt4 key购买 nike

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 构造函数的可选第二个参数需要是什么,但是无论有没有该参数,我都会遇到异常。异常的详细信息完全没有帮助。

想法?

最佳答案

您向数组传递的参数数量错误。对于圆,我们需要三个参数——即坐标和半径。所以你的例子应该如下所示。快乐编码!

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]) }) });

关于javascript - 尝试构造 HERE map HitArea 对象时发生异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41064373/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com