@@ -5751,8 +5751,13 @@ var BaseColorPicker = function (_UIElement) {
5751
5751
_this2 . callbackColorValue ( ) ;
5752
5752
} ;
5753
5753
5754
+ this . callbackLastUpdate = function ( ) {
5755
+ _this2 . callbackLastUpdateColorValue ( ) ;
5756
+ } ;
5757
+
5754
5758
this . colorpickerShowCallback = function ( ) { } ;
5755
5759
this . colorpickerHideCallback = function ( ) { } ;
5760
+ this . colorpickerLastUpdateCallback = function ( ) { } ;
5756
5761
5757
5762
this . $body = new Dom ( this . getContainer ( ) ) ;
5758
5763
this . $root = new Dom ( 'div' , 'easylogic-colorpicker' , {
@@ -5815,14 +5820,15 @@ var BaseColorPicker = function (_UIElement) {
5815
5820
5816
5821
} , {
5817
5822
key : 'show' ,
5818
- value : function show ( opt , color , showCallback , hideCallback ) {
5823
+ value : function show ( opt , color , showCallback , hideCallback , lastUpdateCallback ) {
5819
5824
5820
5825
// 매번 이벤트를 지우고 다시 생성할 필요가 없어서 초기화 코드는 지움.
5821
5826
// this.destroy();
5822
5827
// this.initializeEvent();
5823
5828
// define colorpicker callback
5824
5829
this . colorpickerShowCallback = showCallback ;
5825
5830
this . colorpickerHideCallback = hideCallback ;
5831
+ this . colorpickerLastUpdateCallback = lastUpdateCallback ;
5826
5832
this . $root . css ( this . getInitalizePosition ( ) ) . show ( ) ;
5827
5833
5828
5834
this . isColorPickerShow = true ;
@@ -6084,6 +6090,19 @@ var BaseColorPicker = function (_UIElement) {
6084
6090
this . colorpickerShowCallback ( color ) ;
6085
6091
}
6086
6092
}
6093
+ } , {
6094
+ key : 'callbackLastUpdateColorValue' ,
6095
+ value : function callbackLastUpdateColorValue ( color ) {
6096
+ color = color || this . getCurrentColor ( ) ;
6097
+
6098
+ if ( typeof this . opt . onLastUpdate == 'function' ) {
6099
+ this . opt . onLastUpdate . call ( this , color ) ;
6100
+ }
6101
+
6102
+ if ( typeof this . colorpickerLastUpdateCallback == 'function' ) {
6103
+ this . colorpickerLastUpdateCallback ( color ) ;
6104
+ }
6105
+ }
6087
6106
} , {
6088
6107
key : 'callbackHideColorValue' ,
6089
6108
value : function callbackHideColorValue ( color ) {
@@ -6124,6 +6143,7 @@ var BaseColorPicker = function (_UIElement) {
6124
6143
get ( BaseColorPicker . prototype . __proto__ || Object . getPrototypeOf ( BaseColorPicker . prototype ) , 'initializeStoreEvent' , this ) . call ( this ) ;
6125
6144
6126
6145
this . $store . on ( 'changeColor' , this . callbackChange ) ;
6146
+ this . $store . on ( 'lastUpdateColor' , this . callbackLastUpdate ) ;
6127
6147
this . $store . on ( 'changeFormat' , this . callbackChange ) ;
6128
6148
}
6129
6149
} , {
@@ -6132,9 +6152,11 @@ var BaseColorPicker = function (_UIElement) {
6132
6152
get ( BaseColorPicker . prototype . __proto__ || Object . getPrototypeOf ( BaseColorPicker . prototype ) , 'destroy' , this ) . call ( this ) ;
6133
6153
6134
6154
this . $store . off ( 'changeColor' , this . callbackChange ) ;
6155
+ this . $store . off ( 'lastUpdateColor' , this . callbackLastUpdate ) ;
6135
6156
this . $store . off ( 'changeFormat' , this . callbackChange ) ;
6136
6157
6137
6158
this . callbackChange = undefined ;
6159
+ this . callbackLastUpdate = undefined ;
6138
6160
6139
6161
// remove color picker callback
6140
6162
this . colorpickerShowCallback = undefined ;
@@ -6237,7 +6259,10 @@ var BaseBox = function (_UIElement) {
6237
6259
} , {
6238
6260
key : 'onDragEnd' ,
6239
6261
value : function onDragEnd ( e ) {
6240
- this . isDown = false ;
6262
+ if ( this . isDown ) {
6263
+ this . $store . emit ( 'lastUpdateColor' ) ;
6264
+ this . isDown = false ;
6265
+ }
6241
6266
}
6242
6267
} , {
6243
6268
key : '@changeColor' ,
@@ -6778,7 +6803,10 @@ var ColorWheel = function (_UIElement) {
6778
6803
} , {
6779
6804
key : 'mouseup document' ,
6780
6805
value : function mouseupDocument ( e ) {
6781
- this . isDown = false ;
6806
+ if ( this . isDown ) {
6807
+ this . isDown = false ;
6808
+ this . $store . emit ( 'lastUpdateColor' ) ;
6809
+ }
6782
6810
}
6783
6811
} , {
6784
6812
key : 'mousemove document' ,
@@ -6802,7 +6830,10 @@ var ColorWheel = function (_UIElement) {
6802
6830
} , {
6803
6831
key : 'touchend document' ,
6804
6832
value : function touchendDocument ( e ) {
6805
- this . isDown = false ;
6833
+ if ( this . isDown ) {
6834
+ this . isDown = false ;
6835
+ this . $store . emit ( 'lastUpdateColor' ) ;
6836
+ }
6806
6837
}
6807
6838
} , {
6808
6839
key : 'touchmove document' ,
@@ -6883,6 +6914,7 @@ var ColorInformation = function (_UIElement) {
6883
6914
this . initFormat ( ) ;
6884
6915
6885
6916
this . $store . dispatch ( '/changeFormat' , this . format ) ;
6917
+ this . $store . emit ( 'lastUpdateColor' ) ;
6886
6918
}
6887
6919
} , {
6888
6920
key : 'goToFormat' ,
@@ -6899,6 +6931,23 @@ var ColorInformation = function (_UIElement) {
6899
6931
value : function getFormat ( ) {
6900
6932
return this . format || 'hex' ;
6901
6933
}
6934
+ } , {
6935
+ key : 'checkNumberKey' ,
6936
+ value : function checkNumberKey ( e ) {
6937
+ var code = e . which ,
6938
+ isExcept = false ;
6939
+
6940
+ if ( code == 37 || code == 39 || code == 8 || code == 46 || code == 9 ) isExcept = true ;
6941
+
6942
+ if ( ! isExcept && ( code < 48 || code > 57 ) ) return false ;
6943
+
6944
+ return true ;
6945
+ }
6946
+ } , {
6947
+ key : 'checkNotNumberKey' ,
6948
+ value : function checkNotNumberKey ( e ) {
6949
+ return ! this . checkNumberKey ( e ) ;
6950
+ }
6902
6951
} , {
6903
6952
key : 'changeRgbColor' ,
6904
6953
value : function changeRgbColor ( ) {
@@ -6910,6 +6959,7 @@ var ColorInformation = function (_UIElement) {
6910
6959
a : this . refs . $rgb_a . float ( ) ,
6911
6960
source : source$2
6912
6961
} ) ;
6962
+ this . $store . emit ( 'lastUpdateColor' ) ;
6913
6963
}
6914
6964
} , {
6915
6965
key : 'changeHslColor' ,
@@ -6922,6 +6972,7 @@ var ColorInformation = function (_UIElement) {
6922
6972
a : this . refs . $hsl_a . float ( ) ,
6923
6973
source : source$2
6924
6974
} ) ;
6975
+ this . $store . emit ( 'lastUpdateColor' ) ;
6925
6976
}
6926
6977
} , {
6927
6978
key : '@changeColor' ,
@@ -6982,6 +7033,7 @@ var ColorInformation = function (_UIElement) {
6982
7033
6983
7034
if ( code . charAt ( 0 ) == '#' && ( code . length == 7 || code . length === 9 ) ) {
6984
7035
this . $store . dispatch ( '/changeColor' , code , source$2 ) ;
7036
+ this . $store . emit ( 'lastUpdateColor' ) ;
6985
7037
}
6986
7038
}
6987
7039
} , {
@@ -7204,6 +7256,7 @@ var CurrentColorSets = function (_UIElement) {
7204
7256
key : 'click $colorSetsColorList .color-item' ,
7205
7257
value : function click$colorSetsColorListColorItem ( e ) {
7206
7258
this . $store . dispatch ( '/changeColor' , e . $delegateTarget . attr ( 'data-color' ) ) ;
7259
+ this . $store . emit ( 'lastUpdateColor' ) ;
7207
7260
}
7208
7261
} ] ) ;
7209
7262
return CurrentColorSets ;
@@ -7497,7 +7550,10 @@ var ColorPalette = function (_UIElement) {
7497
7550
} , {
7498
7551
key : 'mouseup document' ,
7499
7552
value : function mouseupDocument ( e ) {
7500
- this . isDown = false ;
7553
+ if ( this . isDown ) {
7554
+ this . isDown = false ;
7555
+ this . $store . emit ( 'lastUpdateColor' ) ;
7556
+ }
7501
7557
}
7502
7558
} , {
7503
7559
key : 'mousemove document' ,
@@ -7512,15 +7568,13 @@ var ColorPalette = function (_UIElement) {
7512
7568
this . isDown = true ;
7513
7569
this . setMainColor ( e ) ;
7514
7570
}
7515
- } , {
7516
- key : 'mouseup' ,
7517
- value : function mouseup ( e ) {
7518
- this . isDown = false ;
7519
- }
7520
7571
} , {
7521
7572
key : 'touchend document' ,
7522
7573
value : function touchendDocument ( e ) {
7523
- this . isDown = false ;
7574
+ if ( this . isDown ) {
7575
+ this . isDown = false ;
7576
+ this . $store . emit ( 'lastUpdateColor' ) ;
7577
+ }
7524
7578
}
7525
7579
} , {
7526
7580
key : 'touchmove document' ,
@@ -7536,11 +7590,6 @@ var ColorPalette = function (_UIElement) {
7536
7590
this . isDown = true ;
7537
7591
this . setMainColor ( e ) ;
7538
7592
}
7539
- } , {
7540
- key : 'touchend' ,
7541
- value : function touchend ( e ) {
7542
- this . isDown = false ;
7543
- }
7544
7593
} ] ) ;
7545
7594
return ColorPalette ;
7546
7595
} ( UIElement ) ;
0 commit comments