Skip to content

Commit aa42c66

Browse files
authored
Merge pull request #4 from kumardeo/fix-onchange
Fix `onChange` firing before changing the color
2 parents 7080b30 + 16688ec commit aa42c66

8 files changed

+12
-12
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ const cPicker = new ColorPicker({
101101

102102
// buttons text & icon
103103
buttons: {
104-
undo : { icon: '', title: 'Undo' },
105-
add : { icon: '+', title: 'Add to Swatches' },
106-
format : { icon: '', title: 'Switch Color Format' }
104+
undo : { icon: '↶', title: 'Undo' },
105+
format : { icon: '⇆', title: 'Switch Color Format' },
106+
add : { icon: '+', title: 'Add to Swatches' }
107107
},
108108

109109
// fired rapidly, on every range slider movement or any color change

dist/color-picker.es.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/color-picker.es.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/color-picker.iife.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/color-picker.iife.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/color-picker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ ColorPicker.prototype = {
6868
return result
6969
},
7070

71-
swithFormat(){
71+
switchFormat(){
7272
const _cf = this.colorFormat
7373

7474
switch( _cf ){

src/defaults.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ export default {
44
onChange: _=>_,
55
buttons: {
66
undo: {
7-
icon: '',
7+
icon: '↶',
88
title: 'Undo'
99
},
1010
format: {
11-
icon: '',
11+
icon: '⇆',
1212
title: 'Switch Color Format'
1313
},
1414
add: {

src/events.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function onButtonClick(e){
7777
// case
7878
// }
7979
if( name == 'format' )
80-
this.swithFormat()
80+
this.switchFormat()
8181

8282
else if( name == 'undo' )
8383
this.history.undo()
@@ -89,7 +89,7 @@ function onButtonClick(e){
8989
this.removeSwatch(pNode, pNode.title)
9090

9191
else if( classList.contains('color-picker__swatch') && title ){
92-
this.history.last = this.color
9392
this.setColor( this.getHSLA(title) )
93+
this.history.last = this.color
9494
}
9595
}

0 commit comments

Comments
 (0)