Proposal : tooltip only when layer name overflow

This commit is contained in:
Guillaume Martigny 2016-12-02 17:21:10 +01:00
parent ad5c8182e4
commit 9d0d38e081
2 changed files with 9 additions and 1 deletions

View File

@ -70,6 +70,8 @@
padding: 0 0 0 10px;
flex: 1 auto;
white-space: nowrap;
}
.layer-item .layer-name.overflowing-name {
overflow: hidden;
text-overflow: ellipsis;
}
@ -79,7 +81,7 @@
}
.layer-item-opacity {
margin-right: 8px;
padding-right: 8px;
}
.current-layer-item,

View File

@ -99,6 +99,12 @@
});
var layerItem = pskl.utils.Template.createFromHTML(layerItemHtml);
this.layersListEl.insertBefore(layerItem, this.layersListEl.firstChild);
if (layerItem.offsetWidth < layerItem.scrollWidth) {
$(layerItem).find('.layer-name')
.addClass('overflowing-name')
.attr('title', pskl.utils.TooltipFormatter.format(layer.getName()))
.tooltip();
}
};
ns.LayersListController.prototype.onClick_ = function (evt) {