mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Css fix + bug fix : double palette created when empty local storage
This commit is contained in:
parent
5b7e07e11e
commit
b734db28dc
@ -15,18 +15,21 @@
|
||||
|
||||
.palettes-list-colors {
|
||||
overflow:hidden;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.palettes-list-color {
|
||||
cursor : pointer;
|
||||
float: left;
|
||||
margin : 0px 0 5px 5px;
|
||||
margin : 0 0 5px 5px;
|
||||
width : 32px;
|
||||
height : 32px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.palettes-list-color:nth-child(-n+5) {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.palettes-list-color div{
|
||||
width : 32px;
|
||||
height : 32px;
|
||||
@ -36,7 +39,7 @@
|
||||
.palettes-list-color.secondary:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: -1px;
|
||||
bottom: 1px;
|
||||
display: inline-block;
|
||||
border: 7px solid gold;
|
||||
border-top-color: transparent;
|
||||
@ -46,12 +49,12 @@
|
||||
}
|
||||
|
||||
.palettes-list-color.primary:before {
|
||||
left: -1px;
|
||||
left: 1px;
|
||||
border-right-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
.palettes-list-color.secondary:before {
|
||||
right: -1px;
|
||||
right: 1px;
|
||||
border-left-color: transparent;
|
||||
}
|
@ -41,7 +41,7 @@
|
||||
if (this.palettes.length > 0) {
|
||||
this.selectPalette(this.palettes[0].id);
|
||||
} else {
|
||||
console.error('[PaletteManagerController] >>> Implement fallback screen when no palette can be retrieved');
|
||||
this.createPalette('New palette');
|
||||
}
|
||||
};
|
||||
|
||||
@ -53,8 +53,10 @@
|
||||
$.publish(Events.DIALOG_HIDE);
|
||||
};
|
||||
|
||||
ns.PaletteManagerController.prototype.createPalette = function () {
|
||||
var name = window.prompt('Please enter a name for your palette', 'New palette');
|
||||
ns.PaletteManagerController.prototype.createPalette = function (name) {
|
||||
if (!name) {
|
||||
name = window.prompt('Please enter a name for your palette', 'New palette');
|
||||
}
|
||||
if (name) {
|
||||
var palette = this.createPaletteObject(name);
|
||||
this.palettes.push(palette);
|
||||
@ -371,7 +373,7 @@
|
||||
|
||||
ns.PaletteManagerController.prototype.retrieveUserPalettes = function () {
|
||||
var palettesString = window.localStorage.getItem('piskel.palettes');
|
||||
return JSON.parse(palettesString) || [this.createPaletteObject('New palette')];
|
||||
return JSON.parse(palettesString) || [];
|
||||
};
|
||||
|
||||
})();
|
Loading…
Reference in New Issue
Block a user