Make toggle button from fix up vector to show if it is on or off.

This commit is contained in:
kovacsv 2018-11-18 08:24:47 +01:00
parent 690452b3df
commit 1902ca43c4
3 changed files with 20 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

View File

@ -32,7 +32,7 @@ ImporterApp.prototype.Init = function ()
importerButtons.AddLogo ('Online 3D Viewer <span class="version">v 0.5.1</span>', function () { myThis.WelcomeDialog (); });
importerButtons.AddButton ('images/openfile.png', 'Open File', function () { myThis.OpenFile (); });
importerButtons.AddButton ('images/fitinwindow.png', 'Fit In Window', function () { myThis.FitInWindow (); });
importerButtons.AddButton ('images/fixup.png', 'Enable/Disable Fixed Up Vector', function () { myThis.SetFixUp (); });
importerButtons.AddToggleButton ('images/fixup.png', 'images/fixupgray.png', 'Enable/Disable Fixed Up Vector', function () { myThis.SetFixUp (); });
importerButtons.AddButton ('images/top.png', 'Set Up Vector (Z)', function () { myThis.SetNamedView ('z'); });
importerButtons.AddButton ('images/bottom.png', 'Set Up Vector (-Z)', function () { myThis.SetNamedView ('-z'); });
importerButtons.AddButton ('images/front.png', 'Set Up Vector (Y)', function () { myThis.SetNamedView ('y'); });

View File

@ -171,6 +171,25 @@ ImporterButtons.prototype.AddButton = function (image, title, onClick)
this.parent.appendChild (buttonImage);
};
ImporterButtons.prototype.AddToggleButton = function (image, toggleImage, title, onClick)
{
var buttonImage = document.createElement ('img');
var isOn = true;
buttonImage.className = 'topbutton';
buttonImage.src = image;
buttonImage.title = title;
buttonImage.onclick = function () {
isOn = !isOn;
if (isOn) {
buttonImage.src = image;
} else {
buttonImage.src = toggleImage;
}
onClick ();
};
this.parent.appendChild (buttonImage);
};
ImporterProgressBar = function (parent)
{
this.parent = parent;