Add details button.

This commit is contained in:
kovacsv 2021-06-20 09:55:46 +02:00
parent 25d209b00f
commit e61aabd77c
7 changed files with 55 additions and 11 deletions

View File

Before

Width:  |  Height:  |  Size: 333 B

After

Width:  |  Height:  |  Size: 333 B

View File

@ -1,5 +1,4 @@
OV.FeatureSet = OV.FeatureSet =
{ {
SetDefaultColor : false, SetDefaultColor : false
CalculateQuantities : false
}; };

View File

@ -310,9 +310,9 @@ OV.Navigator = class
{ {
let obj = this; let obj = this;
if (this.selection === null) { if (this.selection === null) {
let usedMaterial = this.callbacks.getMaterialsForModel (); let usedMaterials = this.callbacks.getMaterialsForModel ();
this.sidebar.AddProperties (null); this.sidebar.AddProperties (null);
this.infoPanel.FillWithModelInfo (usedMaterial, { this.infoPanel.FillWithModelInfo (usedMaterials, {
onMaterialSelect : function (materialIndex) { onMaterialSelect : function (materialIndex) {
obj.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex)); obj.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex));
} }
@ -320,6 +320,7 @@ OV.Navigator = class
} else { } else {
if (this.selection.type === OV.SelectionType.Material) { if (this.selection.type === OV.SelectionType.Material) {
let usedByMeshes = this.callbacks.getMeshesForMaterial (this.selection.index); let usedByMeshes = this.callbacks.getMeshesForMaterial (this.selection.index);
this.sidebar.AddProperties (null);
this.infoPanel.FillWithMaterialInfo (usedByMeshes, { this.infoPanel.FillWithMaterialInfo (usedByMeshes, {
onMeshHover : function (meshIndex) { onMeshHover : function (meshIndex) {
obj.SetTempSelectedMeshIndex (meshIndex); obj.SetTempSelectedMeshIndex (meshIndex);
@ -329,8 +330,9 @@ OV.Navigator = class
} }
}); });
} else if (this.selection.type === OV.SelectionType.Mesh) { } else if (this.selection.type === OV.SelectionType.Mesh) {
let usedByMeshes = this.callbacks.getMaterialsForMesh (this.selection.index); let usedMaterials = this.callbacks.getMaterialsForMesh (this.selection.index);
this.infoPanel.FillWithModelInfo (usedByMeshes, { this.sidebar.AddProperties (null);
this.infoPanel.FillWithModelInfo (usedMaterials, {
onMaterialSelect : function (materialIndex) { onMaterialSelect : function (materialIndex) {
obj.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex)); obj.SetSelection (new OV.Selection (OV.SelectionType.Material, materialIndex));
} }

View File

@ -8,11 +8,27 @@ OV.Sidebar = class
constructor (parentDiv) constructor (parentDiv)
{ {
this.parentDiv = parentDiv; this.parentDiv = parentDiv;
this.visible = true;
this.titleDiv = $('<div>').addClass ('ov_sidebar_title').appendTo (parentDiv); this.titleDiv = $('<div>').addClass ('ov_sidebar_title').appendTo (parentDiv);
this.titleDiv.html ('Details'); this.titleDiv.html ('Details');
this.contentDiv = $('<div>').addClass ('ov_sidebar_content').addClass ('ov_thin_scrollbar').appendTo (parentDiv); this.contentDiv = $('<div>').addClass ('ov_sidebar_content').addClass ('ov_thin_scrollbar').appendTo (parentDiv);
} }
Show (show)
{
this.visible = show;
if (show) {
this.parentDiv.show ();
} else {
this.parentDiv.hide ();
}
}
IsVisible ()
{
return this.visible;
}
AddProperties (properties) AddProperties (properties)
{ {
function AddProperty (table, name, value) function AddProperty (table, name, value)

View File

@ -12,7 +12,7 @@ OV.ToolbarButton = class
CreateDomElement (parentDiv) CreateDomElement (parentDiv)
{ {
this.buttonDiv = $('<div>').addClass ('ov_toolbar_button_div').appendTo (parentDiv); this.buttonDiv = $('<div>').addClass ('ov_toolbar_button').appendTo (parentDiv);
this.buttonImg = $('<img>').addClass ('ov_toolbar_button').appendTo (this.buttonDiv); this.buttonImg = $('<img>').addClass ('ov_toolbar_button').appendTo (this.buttonDiv);
this.buttonImg.attr ('src', this.image); this.buttonImg.attr ('src', this.image);
if (this.onClick !== null) { if (this.onClick !== null) {

View File

@ -175,14 +175,26 @@ div.ov_toolbar
user-select: none; user-select: none;
} }
div.ov_toolbar div.ov_toolbar_button_div div.ov_toolbar div.ov_toolbar_button
{ {
padding: 10px; padding: 10px;
float: left; float: left;
cursor: pointer; cursor: pointer;
} }
div.ov_toolbar div.ov_toolbar_button_div.selected div.ov_toolbar div.ov_toolbar_button
{
padding: 10px;
float: left;
cursor: pointer;
}
div.ov_toolbar div.ov_toolbar_button.right
{
float: right;
}
div.ov_toolbar div.ov_toolbar_button.selected
{ {
background: #e1e1e1; background: #e1e1e1;
} }
@ -675,7 +687,7 @@ a:hover
text-decoration: underline; text-decoration: underline;
} }
div.ov_toolbar div.ov_toolbar_button_div:hover div.ov_toolbar div.ov_toolbar_button:hover
{ {
background: #c9e5f8; background: #c9e5f8;
} }

View File

@ -54,7 +54,9 @@ OV.Website = class
let safetyMargin = 0; let safetyMargin = 0;
if (!OV.IsSmallWidth ()) { if (!OV.IsSmallWidth ()) {
navigatorWidth = parseInt (this.parameters.navigatorDiv.outerWidth (true), 10); navigatorWidth = parseInt (this.parameters.navigatorDiv.outerWidth (true), 10);
sidebarWidth = parseInt (this.parameters.sidebarDiv.outerWidth (true), 10); if (this.sidebar.IsVisible ()) {
sidebarWidth = parseInt (this.parameters.sidebarDiv.outerWidth (true), 10);
}
safetyMargin = 1; safetyMargin = 1;
} }
@ -221,6 +223,14 @@ OV.Website = class
if (onlyFullWidth) { if (onlyFullWidth) {
button.AddClass ('only_full_width'); button.AddClass ('only_full_width');
} }
return button;
}
function AddRightButton (toolbar, imageName, imageTitle, onlyFullWidth, onClick)
{
let button = AddButton (toolbar, imageName, imageTitle, onlyFullWidth, onClick);
button.AddClass ('right');
return button;
} }
function AddRadioButton (toolbar, imageNames, imageTitles, selectedIndex, onlyFullWidth, onClick) function AddRadioButton (toolbar, imageNames, imageTitles, selectedIndex, onlyFullWidth, onClick)
@ -312,6 +322,11 @@ OV.Website = class
}); });
}); });
} }
AddRightButton (this.toolbar, 'details', 'Details Panel', true, function () {
let isVisible = obj.sidebar.IsVisible ();
obj.sidebar.Show (!isVisible);
obj.Resize ();
});
this.parameters.fileInput.on ('change', function (ev) { this.parameters.fileInput.on ('change', function (ev) {
if (ev.target.files.length > 0) { if (ev.target.files.length > 0) {