From 5089321f9f248c22f48f210af9523c7c4cb4d7bb Mon Sep 17 00:00:00 2001 From: alja <amraktadel@ucsd.edu> Date: Wed, 24 Apr 2019 15:49:12 -0700 Subject: [PATCH] Clear highlight when mouse leaves 3d object --- graf3d/eve7/src/REveSelection.cxx | 2 ++ ui5/eve7/controller/GL.controller.js | 17 +++++++++--- ui5/eve7/lib/EveScene.js | 41 +++++++++++++++++++--------- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/graf3d/eve7/src/REveSelection.cxx b/graf3d/eve7/src/REveSelection.cxx index 1cd7a2f7ebd..053129882e4 100644 --- a/graf3d/eve7/src/REveSelection.cxx +++ b/graf3d/eve7/src/REveSelection.cxx @@ -259,6 +259,8 @@ void REveSelection::SelectionCleared() { // XXXX // Emit("SelectionCleared()"); + fMap.clear(); + StampObjProps(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/ui5/eve7/controller/GL.controller.js b/ui5/eve7/controller/GL.controller.js index 1e6ae8a7776..82f478caef6 100644 --- a/ui5/eve7/controller/GL.controller.js +++ b/ui5/eve7/controller/GL.controller.js @@ -322,6 +322,8 @@ sap.ui.define([ this.geo_painter._camera.bottom = -this.getView().$().height(); this.geo_painter._camera.updateProjectionMatrix(); } + + painter.eveGLcontroller = this; painter._controls.ProcessMouseMove = function(intersects) { var active_mesh = null, tooltip = null, resolve = null, names = [], geo_object, geo_index; @@ -350,8 +352,16 @@ sap.ui.define([ } } - //painter.HighlightMesh(active_mesh, undefined, geo_object, geo_index); AMT override - if (active_mesh && active_mesh.get_ctrl()) active_mesh.get_ctrl().setHighlight( 0xffaa33, geo_index); + // painter.HighlightMesh(active_mesh, undefined, geo_object, geo_index); AMT override + if (active_mesh && active_mesh.get_ctrl()){ + active_mesh.get_ctrl().setHighlight( 0xffaa33, geo_index); + } + else { + var sl = painter.eveGLcontroller.created_scenes; + for (var k=0; k < sl.length; ++k) + sl[k].clearHighlight(); + } + if (painter.options.update_browser) { if (painter.options.highlight && tooltip) names = [ tooltip ]; @@ -393,8 +403,7 @@ sap.ui.define([ if (this.geo_painter){ this.geo_painter.CheckResize(); } - } - + }, }); }); diff --git a/ui5/eve7/lib/EveScene.js b/ui5/eve7/lib/EveScene.js index 3c0006196ca..5e1075a258c 100644 --- a/ui5/eve7/lib/EveScene.js +++ b/ui5/eve7/lib/EveScene.js @@ -218,7 +218,7 @@ sap.ui.define([ container.add(obj3d); this.id2obj_map[el.fElementId] = obj3d; - if (el.fMasterId) this.mid2obj_map[el.fMasterId] = obj3d; + if (el.fMasterId) this.mid2obj_map[el.fMasterId] = obj3d; } EveScene.prototype.visibilityChanged = function(el) @@ -252,7 +252,7 @@ sap.ui.define([ EveScene.prototype.processElementSelected = function(obj3d, col, indx, evnt) { // MT BEGIN - console.log("EveScene.prototype.processElementSelected", obj3d, col, indx, evnt); + // console.log("EveScene.prototype.processElementSelected", obj3d, col, indx, evnt); var is_multi = evnt && evnt.ctrlKey; var is_secsel = indx !== undefined; @@ -344,16 +344,16 @@ sap.ui.define([ EveScene.prototype.processElementHighlighted = function(obj3d, col, indx, evnt) { // Need check for duplicates before call server, else server will un-higlight highlighted element - // console.log("EveScene.prototype.processElementHighlighted", obj3d, col, indx, evnt); + // console.log("EveScene.prototype.processElementHighlighted", obj3d.eveId, col, indx, evnt); var is_multi = false; var is_secsel = indx !== undefined; var so = this.mgr.GetElement(this.mgr.global_highlight_id); var a = so.prev_sel_list; - + // AMT presume there is no multiple highlight and multiple secondary selections // if that is the case in the futre write data in set and comapre sets - + // console.log("EveScene.prototype.processElementHighlighted compare Reveselection ", a[0], "incoming ", obj3d.eveId,indx); if (a.length == 1 ) { var h = a[0]; @@ -370,7 +370,7 @@ sap.ui.define([ } } } - + var fcall = "NewElementPicked(" + obj3d.eveId + `, ${is_multi}, ${is_secsel}`; if (is_secsel) { @@ -387,6 +387,21 @@ sap.ui.define([ return true; } + + EveScene.prototype.clearHighlight = function() + { + var so = this.mgr.GetElement(this.mgr.global_highlight_id); + if (so.prev_sel_list.length) { + console.log("clearHighlight", this); + this.mgr.SendMIR({ "mir": "SelectionCleared()", + "fElementId": this.mgr.global_highlight_id, + "class": "REX::REveSelection" + }); + } + + return true; + } + /** returns true if highlight index is differs from current */ EveScene.prototype.processCheckHighlight = function(obj3d, indx) { @@ -424,7 +439,7 @@ sap.ui.define([ this.drawSpecial(mstrid, true); } - +/* EveScene.prototype.drawSpecial = function(mstrid, prefer_highlight) { var obj3d = this.getObj3D( mstrid, true ); @@ -485,13 +500,13 @@ sap.ui.define([ return did_change; } - +*/ EveScene.prototype.SelectElement = function(selection_obj, element_id, sec_idcs) { var stype = selection_obj.fName.endsWith("Selection") ? "select" : "highlight"; var estype = THREE.OutlinePass.selection_enum[stype]; - - let res = { + + let res = { "sel_type": estype, "sec_sel": false, "geom": [] @@ -559,15 +574,15 @@ sap.ui.define([ if (!obj3d) { console.log("ERROOR cant find obj3d"); } - + var container = this.viewer.getThreejsContainer("scene" + this.id); container.remove(obj3d); - + // console.log("EveScene elementRemoved AFTER ", container); delete this.id2obj_map[elId]; } } - + return EveScene; }); -- GitLab