From 694dcccf27cf5862df1944c7a42bdcec6832d919 Mon Sep 17 00:00:00 2001 From: kovacsv Date: Fri, 11 Jan 2019 08:02:45 +0100 Subject: [PATCH] Highlight button in mesh menu, too. --- website/images/highlightmesh.png | Bin 0 -> 236 bytes website/include/importerapp.js | 38 +++++++++++++++++++++---------- website/include/importermenu.js | 5 ++++ 3 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 website/images/highlightmesh.png diff --git a/website/images/highlightmesh.png b/website/images/highlightmesh.png new file mode 100644 index 0000000000000000000000000000000000000000..86ac97ae075cb33581aa4e83a0d41f278c49a09c GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^{2!lvI6;>1s;*b z3=DjGK$vmro+3}6phSslL`iUdT1k0gQ7S`0VrE{6US4X6f{C7?o@t7E1jytpPZ!4! z3;(%2+').addClass ('meshimgbutton').attr ('src', 'images/highlightmesh.png').attr ('title', 'Highlight Mesh').appendTo (meshButtons); + highlightButton.click (function () { + importerApp.HighlightMesh (meshIndex); + }); var copyNameToClipboardButton = $('').addClass ('meshimgbutton').attr ('src', 'images/copytoclipboard.png').attr ('title', 'Copy Mesh Name To Clipboard').appendTo (meshButtons); copyNameToClipboardButton.click (function () { - CopyToClipboard (mesh.name); + CopyToClipboard (meshName); }); } @@ -268,7 +272,7 @@ ImporterApp.prototype.GenerateMenu = function () onOpen : function (contentDiv, mesh) { contentDiv.empty (); - AddMeshButtons (contentDiv, mesh); + AddMeshButtons (importerApp, contentDiv, mesh.name, meshIndex); var table = new InfoTable (contentDiv); var min = new JSM.Coord (JSM.Inf, JSM.Inf, JSM.Inf); @@ -538,6 +542,24 @@ ImporterApp.prototype.RegisterCanvasClick = function (canvasName) }); }; +ImporterApp.prototype.HighlightMesh = function (meshIndex) +{ + var i, menuItem; + for (i = 0; i < this.meshMenuItems.length; i++) { + menuItem = this.meshMenuItems[i]; + if (i == meshIndex) { + if (!menuItem.IsHighlighted ()) { + menuItem.Highlight (true); + menuItem.menuItemDiv.get (0).scrollIntoView (); + } else { + menuItem.Highlight (false); + } + } else { + menuItem.Highlight (false); + } + } +}; + ImporterApp.prototype.OnCanvasClick = function (x, y) { var objects = this.viewer.GetMeshesUnderPosition (x, y); @@ -547,15 +569,7 @@ ImporterApp.prototype.OnCanvasClick = function (x, y) this.meshesGroup.SetOpen (true); } - var i; - for (i = 0; i < this.meshMenuItems.length; i++) { - if (i == meshIndex) { - this.meshMenuItems[i].Highlight (true); - this.meshMenuItems[i].menuItemDiv.get (0).scrollIntoView (); - } else { - this.meshMenuItems[i].Highlight (false); - } - } + this.HighlightMesh (meshIndex); }; ImporterApp.prototype.DragOver = function (event) diff --git a/website/include/importermenu.js b/website/include/importermenu.js index cfa9cee..4558cc2 100644 --- a/website/include/importermenu.js +++ b/website/include/importermenu.js @@ -137,6 +137,11 @@ ImporterMenuItem.prototype.Highlight = function (highlight) } }; +ImporterMenuItem.prototype.IsHighlighted = function () +{ + return this.menuItemDiv.hasClass ('highlighted'); +}; + ImporterMenu = function (parentDiv) { this.parentDiv = parentDiv;