don't change current palette when editing a different palette
This commit is contained in:
parent
b27632b6a3
commit
002863b88a
|
@ -324,14 +324,18 @@ $(document).ready(function() {
|
|||
|
||||
// these inputs get added and removed from the DOM so the event handler needs to be on the document
|
||||
$(document).on('change', '#palette input', function() {
|
||||
var id = parseInt($(this).closest('.palette').find('input[name="id"]').val());
|
||||
|
||||
// if this is a colour input, update the palette
|
||||
if ($(this).attr('type') === 'color') {
|
||||
if (id === palette.id) {
|
||||
palette[$(this).attr('name')] = hexToColour($(this).val());
|
||||
}
|
||||
}
|
||||
|
||||
// if this is a radio button, pick this palette
|
||||
if ($(this).attr('type') === 'radio') {
|
||||
palette.id = parseInt( $(this).closest('.palette').find('input[name="id"]' ).val());
|
||||
palette.id = id;
|
||||
palette.background = hexToColour($(this).closest('.palette').find('input[name="background"]').val());
|
||||
palette.tile = hexToColour($(this).closest('.palette').find('input[name="tile"]' ).val());
|
||||
// sprite colour is not currently used
|
||||
|
|
Loading…
Reference in New Issue