|
|
此功能仅适用于模型,不支持区域目标、图像目标和 3D 图像。
|
{
"position": [
100.987,
-200.654,
300.321
],
"normal": [
0.6,
-0.8,
0.0
]
}
{
"position": [],
"normal": []
}
|
|
• userpick 事件仅适用于全局坐标,不适用于相对坐标。
• userpick 事件仅针对模型发送。
|
$scope.$on('userpick', function (event, targetName, targetType, eventData) {
// event data will be empty for 3D images
//
if (eventData == []) {
console.error('Pick on unsupported object: No event data')
return
}
// the pick event gives us the item id, position and normal
//
let position = JSON.parse(eventData).position
// geometric information will not be available
// for unsupported objects
if (position.length != 3) {
console.error('Pick on unsupported object: No position data')
return
}
// put a "ball" at the point the user just touched
//
$scope.setWidgetProp("ball", "x", position[0]);
$scope.setWidgetProp("ball", "y", position[1]);
$scope.setWidgetProp("ball", "z", position[2]);
})