integrate @lukevers improvements and clean up js a bit
This commit is contained in:
parent
bd2034c47b
commit
ef821c3e7e
@ -30,7 +30,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
.canvas-container {
|
.canvas-container {
|
||||||
border: 5px solid black;
|
border: 1px solid black;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
background: white;
|
background: white;
|
||||||
}
|
}
|
||||||
@ -40,10 +40,9 @@
|
|||||||
}
|
}
|
||||||
#colors {
|
#colors {
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
border: 3px solid black;
|
|
||||||
padding: 5px;
|
|
||||||
vertical-align: top;
|
|
||||||
background: white;
|
background: white;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
.selected {
|
.selected {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
@ -61,13 +60,13 @@
|
|||||||
width: 4vw;
|
width: 4vw;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
border: 2px solid black;
|
border: 1px solid black;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
#controls {
|
#controls {
|
||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
border: 3px solid black;
|
border-top: 1px solid black;
|
||||||
background: white;
|
background: white;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
line-height: 100px;
|
line-height: 100px;
|
||||||
@ -86,6 +85,9 @@
|
|||||||
height: 0;
|
height: 0;
|
||||||
z-index: -5;
|
z-index: -5;
|
||||||
}
|
}
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@ -226,6 +226,7 @@ define([
|
|||||||
};
|
};
|
||||||
|
|
||||||
var addColorToPalette = function (color, i) {
|
var addColorToPalette = function (color, i) {
|
||||||
|
if (readOnly) { return; }
|
||||||
var $color = $('<span>', {
|
var $color = $('<span>', {
|
||||||
'class': 'palette-color',
|
'class': 'palette-color',
|
||||||
})
|
})
|
||||||
@ -236,7 +237,6 @@ define([
|
|||||||
var c = rgb2hex($color.css('background-color'));
|
var c = rgb2hex($color.css('background-color'));
|
||||||
setColor(c);
|
setColor(c);
|
||||||
})
|
})
|
||||||
// FIXME double click doesn't seem to work in chromium currently
|
|
||||||
.on('dblclick', function (e) {
|
.on('dblclick', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
pickColor(rgb2hex($color.css('background-color')), function (c) {
|
pickColor(rgb2hex($color.css('background-color')), function (c) {
|
||||||
@ -247,17 +247,14 @@ define([
|
|||||||
config.onLocal();
|
config.onLocal();
|
||||||
setColor(c);
|
setColor(c);
|
||||||
});
|
});
|
||||||
// TODO commit chosen color to pad metadata:
|
|
||||||
// json.metadata.palette[i]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$colors.append($color);
|
$colors.append($color);
|
||||||
};
|
};
|
||||||
palette.forEach(addColorToPalette);
|
|
||||||
|
|
||||||
var updatePalette = function (newPalette) {
|
var updatePalette = function (newPalette) {
|
||||||
palette = newPalette;
|
palette = newPalette;
|
||||||
$colors.html(' ');
|
$colors.html('<div class="hidden"> </div>');
|
||||||
palette.forEach(addColorToPalette);
|
palette.forEach(addColorToPalette);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user