From 7b8cdb79a6c59ebac2946167c93c12b8a38afa0e Mon Sep 17 00:00:00 2001 From: kovacsv Date: Sat, 19 Jun 2021 22:50:46 +0200 Subject: [PATCH] Remove information from navigator info panel. --- tools/config.json | 1 - website/embed.html | 1 - website/index.html | 1 - website/o3dv/navigator.js | 105 ++++++++++++++++++++++++++++++++++++-- website/o3dv/website.css | 89 ++------------------------------ 5 files changed, 104 insertions(+), 93 deletions(-) diff --git a/tools/config.json b/tools/config.json index 38c4f05..4e81ecd 100644 --- a/tools/config.json +++ b/tools/config.json @@ -75,7 +75,6 @@ "website/o3dv/quantitiesdialog.js", "website/o3dv/cookiedialog.js", "website/o3dv/modeldata.js", - "website/o3dv/info.js", "website/o3dv/navigator.js", "website/o3dv/hashhandler.js", "website/o3dv/website.css", diff --git a/website/embed.html b/website/embed.html index 0a56b6f..289256e 100644 --- a/website/embed.html +++ b/website/embed.html @@ -89,7 +89,6 @@ - diff --git a/website/index.html b/website/index.html index bef4da5..d82903b 100644 --- a/website/index.html +++ b/website/index.html @@ -89,7 +89,6 @@ - diff --git a/website/o3dv/navigator.js b/website/o3dv/navigator.js index c71ec9b..08daa21 100644 --- a/website/o3dv/navigator.js +++ b/website/o3dv/navigator.js @@ -13,6 +13,105 @@ OV.Selection = class } }; +OV.NavigatorInfoPanel = class +{ + constructor (parentDiv) + { + this.parentDiv = parentDiv; + this.popup = null; + } + + FillWithMaterialInfo (info, callbacks) + { + this.Clear (); + if (info === null) { + return; + } + + let meshItems = []; + for (let i = 0; i < info.usedByMeshes.length; i++) { + let meshInfo = info.usedByMeshes[i]; + meshItems.push ({ + name : OV.GetMeshName (meshInfo.name) + }); + } + + let obj = this; + let meshesText = 'Meshes (' + meshItems.length + ')'; + this.CreateButton (this.parentDiv, meshesText, function (button) { + if (meshItems.length === 0) { + return; + } + obj.popup = OV.ShowListPopup (button, meshItems, { + onHoverStart : function (index) { + const meshItem = info.usedByMeshes[index]; + callbacks.onMeshHover (meshItem.index); + }, + onHoverStop : function (index) { + callbacks.onMeshHover (null); + }, + onClick : function (index) { + const meshItem = info.usedByMeshes[index]; + callbacks.onMeshSelect (meshItem.index); + } + }); + }); + } + + FillWithModelInfo (info, callbacks) + { + this.Clear (); + if (info === null) { + return; + } + + let materialItems = []; + for (let i = 0; i < info.usedMaterials.length; i++) { + let usedMaterial = info.usedMaterials[i]; + materialItems.push ({ + name : OV.GetMaterialName (usedMaterial.name), + color : OV.ColorToHexString (usedMaterial.diffuse) + }); + } + + let obj = this; + if (OV.FeatureSet.CalculateQuantities) { + this.CreateButton (this.parentDiv, 'Calculate Quantities', function (button) { + obj.popup = OV.ShowQuantitiesPopup (button, info.element); + }); + } + + let materialsText = 'Materials (' + materialItems.length + ')'; + this.CreateButton (this.parentDiv, materialsText, function (button) { + obj.popup = OV.ShowListPopup (button, materialItems, { + onClick : function (index) { + let usedMaterial = info.usedMaterials[index]; + callbacks.onMaterialSelect (usedMaterial.index); + } + }); + }); + } + + CreateButton (parentDiv, buttonText, onClick) + { + let button = $('
').addClass ('ov_navigator_info_button').appendTo (parentDiv); + $('
').addClass ('ov_navigator_info_button_text').html (buttonText).appendTo (button); + $('').addClass ('ov_navigator_info_button_icon').attr ('src', 'assets/images/tree/arrow_right.svg').appendTo (button); + button.click (function () { + onClick (button); + }); + } + + Clear () + { + if (this.popup !== null) { + this.popup.Hide (); + this.popup = null; + } + this.parentDiv.empty (); + } +}; + OV.Navigator = class { constructor (parentDiv) @@ -23,7 +122,7 @@ OV.Navigator = class this.treeDiv = $('
').addClass ('ov_navigator_tree_panel').addClass ('ov_thin_scrollbar').appendTo (parentDiv); this.infoDiv = $('
').addClass ('ov_navigator_info_panel').addClass ('ov_thin_scrollbar').appendTo (parentDiv); this.treeView = new OV.TreeView (this.treeDiv); - this.infoPanel = new OV.InfoPanel (this.infoDiv); + this.infoPanel = new OV.NavigatorInfoPanel (this.infoDiv); this.modelData = new OV.ModelData (); this.selection = null; this.tempSelectedMeshIndex = null; @@ -31,11 +130,7 @@ OV.Navigator = class Init (callbacks) { - let obj = this; this.callbacks = callbacks; - this.infoPanel.SetOpenCloseHandler (function () { - obj.Resize (); - }); } Resize () diff --git a/website/o3dv/website.css b/website/o3dv/website.css index 113f9a3..0fc77b6 100644 --- a/website/o3dv/website.css +++ b/website/o3dv/website.css @@ -217,88 +217,7 @@ div.ov_navigator_info_panel border-top: 1px solid #dddddd; } -div.ov_navigator_info_panel div.ov_info_panel_main -{ - margin-top: 5px; -} - -div.ov_navigator_info_panel div.ov_info_panel_content -{ - padding: 5px 0px 0px 5px; -} - -div.ov_navigator_info_panel div.ov_info_box -{ - margin-bottom: 10px; - overflow: auto; -} - -div.ov_navigator_info_panel div.ov_info_box_column -{ - float: left; -} - -div.ov_navigator_info_panel div.ov_info_box_title -{ - margin-bottom: 3px; -} - -div.ov_navigator_info_panel div.ov_info_box_content -{ - font-weight: bold; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -div.ov_navigator_info_panel div.ov_info_box_content_big -{ - font-size: 21px; - font-weight: bold; -} - -div.ov_navigator_info_panel div.ov_info_box_details -{ - font-size: 14px; - padding-left: 10px; -} - -div.ov_navigator_info_panel div.ov_info_box_row -{ - padding: 2px 0px; - overflow: auto; -} - -div.ov_navigator_info_panel div.ov_info_box_row_name -{ - width: 40%; - float: left; -} - -div.ov_navigator_info_panel div.ov_info_box_row_value -{ - font-weight: bold; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -div.ov_navigator_info_panel div.ov_info_box_rgbbox -{ - width : 32px; - height: 16px; - margin-right: 10px; - border: 1px solid #222222; - border-radius: 5px; - float: left; -} - -div.ov_navigator_info_panel div.ov_info_box_rgbtext -{ - font-size: 14px; -} - -div.ov_navigator_info_panel div.ov_info_box_button +div.ov_navigator_info_panel div.ov_navigator_info_button { cursor: pointer; margin-top: 10px; @@ -307,13 +226,13 @@ div.ov_navigator_info_panel div.ov_info_box_button overflow: auto; } -div.ov_navigator_info_panel div.ov_info_box_button_text +div.ov_navigator_info_panel div.ov_navigator_info_button_text { padding: 5px; float: left; } -div.ov_navigator_info_panel img.ov_info_box_button_icon +div.ov_navigator_info_panel img.ov_navigator_info_button_icon { width: 18px; height: 18px; @@ -747,7 +666,7 @@ div.ov_popup div.ov_popup_list_item:hover background: #e4f4ff; } -div.ov_navigator_info_panel div.ov_info_box_button:hover +div.ov_navigator_info_panel div.ov_navigator_info_button:hover { background: #e4f4ff; }