Handle open/close images inside of menu instead of parameters.

This commit is contained in:
kovacsv 2018-12-17 19:47:29 +01:00
parent 3ba1e1a9fa
commit d4f4fd1862
2 changed files with 4 additions and 17 deletions

View File

@ -187,9 +187,6 @@ ImporterApp.prototype.GenerateMenu = function ()
var group = menu.AddGroup (name, {
id : id,
openCloseButton : {
isOpen : false,
open : 'images/opened.png',
close : 'images/closed.png',
title : 'Show/Hide ' + name
}
});
@ -223,9 +220,6 @@ ImporterApp.prototype.GenerateMenu = function ()
{
materialsGroup.AddSubItem (material.name, {
openCloseButton : {
isOpen : false,
open : 'images/opened.png',
close : 'images/closed.png',
onOpen : function (contentDiv, material) {
contentDiv.empty ();
var table = new InfoTable (contentDiv);
@ -245,9 +239,6 @@ ImporterApp.prototype.GenerateMenu = function ()
{
meshesGroup.AddSubItem (mesh.name, {
openCloseButton : {
isOpen : false,
open : 'images/opened.png',
close : 'images/closed.png',
onOpen : function (contentDiv, mesh) {
contentDiv.empty ();
var table = new InfoTable (contentDiv);

View File

@ -52,14 +52,10 @@ ImporterMenuItem.prototype.Initialize = function (name)
menuItemDiv.attr ('id', this.parameters.id);
}
if (this.parameters.openCloseButton !== undefined && this.parameters.openCloseButton !== null) {
this.contentDiv = $('<div>').addClass ('menugroup').appendTo (this.parentDiv);
this.isOpen = this.parameters.openCloseButton.isOpen;
if (!this.isOpen) {
this.contentDiv.hide ();
}
this.contentDiv = $('<div>').addClass ('menugroup').hide ().appendTo (this.parentDiv);
this.isOpen = false;
this.openCloseImage = $('<img>').addClass ('menubutton').attr ('title', this.parameters.openCloseButton.title).appendTo (menuItemDiv);
this.openCloseImage.attr ('src', this.isOpen ? this.parameters.openCloseButton.open : this.parameters.openCloseButton.close);
this.openCloseImage.attr ('src', 'images/closed.png');
menuItemClickHandler = this.OnOpenCloseClick.bind (this);
this.openCloseImage.click (menuItemClickHandler);
}
@ -110,7 +106,7 @@ ImporterMenuItem.prototype.OnOpenCloseClick = function ()
}
}
this.contentDiv.toggle ();
this.openCloseImage.attr ('src', this.isOpen ? this.parameters.openCloseButton.open : this.parameters.openCloseButton.close);
this.openCloseImage.attr ('src', this.isOpen ? 'images/opened.png' : 'images/closed.png');
};
ImporterMenuItem.prototype.GetTruncatedName = function (name)