Merge pull request #510 from juliandescottes/scroll-selected-layer

Issue #502: scroll selected layer into view when redrawing layer list
This commit is contained in:
Julian Descottes 2016-07-24 19:22:17 +02:00 committed by GitHub
commit 94b781a2e5

View File

@ -31,6 +31,12 @@
var layers = this.piskelController.getLayers(); var layers = this.piskelController.getLayers();
layers.forEach(this.addLayerItem.bind(this)); layers.forEach(this.addLayerItem.bind(this));
this.updateButtonStatus_(); this.updateButtonStatus_();
// Ensure the currently the selected layer is visible.
var currentLayerEl = this.layersListEl.querySelector('.current-layer-item');
if (currentLayerEl) {
currentLayerEl.scrollIntoView();
}
}; };
ns.LayersListController.prototype.initToggleLayerPreview_ = function () { ns.LayersListController.prototype.initToggleLayerPreview_ = function () {