AnsweredAssumed Answered

pointer-move event in SceneView

Question asked by di_minglei on Feb 23, 2018

Hi there,

 

I try to add tooltip on graphics in mouse over event, it works in 2D mapview, but in 3D SceneView, the event object doesn't have screenPoint.native properties(like 2D has), it only has event.screenPoint, which cannot be used for placing my tooltip dialog, since the map view is just part of my web page. Here're my code, I use dijit/place to place tooltip:

 
_showToolTipDialog(event: any, dialogId: string, tipContent: string, tipStyle: any) {
let dialog = registry.byId(dialogId);
if (dialog) {
   dialog.destroy();
}
if (tipStyle) {
   dialog = new TooltipDialog({
      id: dialogId,
      content: tipContent,
      style: tipStyle
});
} else {
   dialog = new TooltipDialog({
   id: dialogId,
   content: tipContent,
   "class": this.config.tooltipDialogStyle
});
}
dialog.startup();
let x, y;
if (event.screenPoint.native) {  // 2d has native coordination
   x = event.screenPoint.native.x;
   y = event.screenPoint.native.y;
} else// 3d doesn't have native coordination
   x = event.screenPoint[0];
   y = event.screenPoint[1];
}

place.at(dialog.domNode, { x: x, y: y }, ["TL", "BL"], { x: 10, y: 10 });
}

 

 

Why event is different between 2D and 3D view? Can anyone help?

 

Thanks,

Benjamin

 

Outcomes