Use css text-overflow instead of manual string clipping.

This commit is contained in:
kovacsv 2018-12-18 07:30:10 +01:00
parent d4f4fd1862
commit 664737efdf
3 changed files with 4 additions and 12 deletions

View File

@ -120,7 +120,8 @@ div.extbutton img
div.menuitem
{
padding : 2px;
overflow : auto;
text-overflow: ellipsis;
overflow : hidden;
}
div.menugroup

View File

@ -45,7 +45,7 @@ ImporterApp.prototype.Init = function ()
var myThis = this;
var top = document.getElementById ('top');
this.importerButtons = new ImporterButtons (top);
this.importerButtons.AddLogo ('Online 3D Viewer <span class="version">v 0.5.1</span>', function () { myThis.WelcomeDialog (); });
this.importerButtons.AddLogo ('Online 3D Viewer <span class="version">v 0.5.2</span>', function () { myThis.WelcomeDialog (); });
this.importerButtons.AddButton ('images/openfile.png', 'Open File', function () { myThis.OpenFile (); });
this.importerButtons.AddButton ('images/fitinwindow.png', 'Fit In Window', function () { myThis.FitInWindow (); });
this.importerButtons.AddToggleButton ('images/fixup.png', 'images/fixupgray.png', 'Enable/Disable Fixed Up Vector', function () { myThis.SetFixUp (); });

View File

@ -76,7 +76,7 @@ ImporterMenuItem.prototype.Initialize = function (name)
}
}
var menuItemTextDiv = $('<div>').addClass ('menuitem').html (this.GetTruncatedName (name)).attr ('title', name).appendTo (menuItemDiv);
var menuItemTextDiv = $('<div>').addClass ('menuitem').html (name).attr ('title', name).appendTo (menuItemDiv);
if (menuItemClickHandler != null) {
menuItemTextDiv.css ('cursor', 'pointer');
menuItemTextDiv.click (menuItemClickHandler);
@ -109,15 +109,6 @@ ImporterMenuItem.prototype.OnOpenCloseClick = function ()
this.openCloseImage.attr ('src', this.isOpen ? 'images/opened.png' : 'images/closed.png');
};
ImporterMenuItem.prototype.GetTruncatedName = function (name)
{
var maxLength = 20;
if (name.length > maxLength) {
return name.substr (0, maxLength) + '...';
}
return name;
};
ImporterMenu = function (parentDiv)
{
this.parentDiv = parentDiv;