mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Issue #663 - display 10 colors per row in palette for palettes with > 10 colors
This commit is contained in:
@ -51,12 +51,14 @@
|
||||
};
|
||||
|
||||
ns.PalettesListController.prototype.fillColorListContainer = function () {
|
||||
|
||||
var colors = this.getSelectedPaletteColors_();
|
||||
|
||||
if (colors.length > 0) {
|
||||
var html = colors.map(function (color, index) {
|
||||
return pskl.utils.Template.replace(this.paletteColorTemplate_, {color : color, index : index});
|
||||
return pskl.utils.Template.replace(this.paletteColorTemplate_, {
|
||||
color : color,
|
||||
index : index + 1
|
||||
});
|
||||
}.bind(this)).join('');
|
||||
this.colorListContainer_.innerHTML = html;
|
||||
|
||||
@ -64,6 +66,10 @@
|
||||
} else {
|
||||
this.colorListContainer_.innerHTML = pskl.utils.Template.get('palettes-list-no-colors-partial');
|
||||
}
|
||||
|
||||
// If we have more than 10 colors, use tiny mode, where 10 colors will fit on the same
|
||||
// line.
|
||||
this.colorListContainer_.classList.toggle('tiny', colors.length > 10);
|
||||
};
|
||||
|
||||
ns.PalettesListController.prototype.selectPalette = function (paletteId) {
|
||||
@ -101,7 +107,7 @@
|
||||
var currentIndex = 0;
|
||||
var selectedColor = document.querySelector('.' + PRIMARY_COLOR_CLASSNAME);
|
||||
if (selectedColor) {
|
||||
currentIndex = parseInt(selectedColor.dataset.colorIndex, 10);
|
||||
currentIndex = parseInt(selectedColor.dataset.colorIndex, 10) - 1;
|
||||
}
|
||||
return currentIndex;
|
||||
};
|
||||
|
Reference in New Issue
Block a user