fix:update getHitResult api

This commit is contained in:
“李仕蓬”
2023-04-03 10:53:49 +08:00
parent e6828978ea
commit b2af686836

View File

@ -207,14 +207,14 @@
// create hotpoint... // create hotpoint...
if (addingHotpoint && target instanceof HTMLCanvasElement) { if (addingHotpoint && target instanceof HTMLCanvasElement) {
const result = viewer.getHitResult(event); const location = viewer.getHitResult(event);
if (!result || !result.location) { if (!location) {
return; return;
} }
const hotpointId = `hotpoint_${hotpointCount}`; const hotpointId = `hotpoint_${hotpointCount}`;
const hotpoint = { const hotpoint = {
hotpointId, hotpointId,
anchorPosition: [result.location[0], result.location[1]], anchorPosition: [location.x, location.y],
visible: true, visible: true,
html: `<div class="hotpoint" id="hotpoint_${hotpointId}"> html: `<div class="hotpoint" id="hotpoint_${hotpointId}">
<div class="hotpoint-dot" id="hotpoint-dot_${hotpointId}"></div> <div class="hotpoint-dot" id="hotpoint-dot_${hotpointId}"></div>