Browse Source

isHover check for UpdateText

master
Cailean Finn 6 months ago
parent
commit
05e4a7fd20
  1. 8
      public/js/main.js

8
public/js/main.js

@ -130,6 +130,7 @@ let texture, planeMat, mesh, moloch_txt;
let lastTime = 0; // Keep track of the last frame time let lastTime = 0; // Keep track of the last frame time
let textGeo, textWidth, textMaterial, textMesh; let textGeo, textWidth, textMaterial, textMesh;
let text_Geometries = []; let text_Geometries = [];
let isHovering = false;
const pickPosition = {x: 0, y: 0}; const pickPosition = {x: 0, y: 0};
const pickHelper = new PickHelper(); const pickHelper = new PickHelper();
const object_list = [] const object_list = []
@ -306,15 +307,18 @@ window.addEventListener('resize', () => {
const pickedArticle = object_list.find(article => article.mesh === pickHelper.pickedObject); const pickedArticle = object_list.find(article => article.mesh === pickHelper.pickedObject);
if (pickedArticle) { if (pickedArticle) {
document.body.style.cursor = 'pointer'; document.body.style.cursor = 'pointer';
UpdateText(pickedArticle.name); if (!isHovering)
UpdateText(pickedArticle.name);
}else{ }else{
document.body.style.cursor = 'default'; document.body.style.cursor = 'default';
UpdateText(""); ClearTextGeoList();
isHovering = false
} }
} }
function UpdateText(text) { function UpdateText(text) {
MeasureText(text); MeasureText(text);
isHovering = true
} }
function ClearTextGeoList() { function ClearTextGeoList() {

Loading…
Cancel
Save