mirror of
https://github.com/pebble-dev/clay.git
synced 2026-08-31 06:16:51 -04:00
When setting the value for the color picker, round it to the closest available value in the layout
This commit is contained in:
@@ -145,16 +145,12 @@ module.exports = {
|
||||
},
|
||||
color: {
|
||||
get: function() {
|
||||
return parseInt(this.$manipulatorTarget.get('value'), 16);
|
||||
return parseInt(this.$manipulatorTarget.get('value'), 10) || 0;
|
||||
},
|
||||
set: function(value) {
|
||||
switch (typeof value) {
|
||||
case 'number': value = value.toString(16); break;
|
||||
case 'string': value = value.replace(/^#|^0x/, ''); break;
|
||||
}
|
||||
value = value || '000000';
|
||||
value = this.roundColorToLayout(value || 0);
|
||||
|
||||
if (this.get() === parseInt(value, 16)) { return this; }
|
||||
if (this.get() === value) { return this; }
|
||||
this.$manipulatorTarget.set('value', value);
|
||||
return this.trigger('change');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user