11/*!
2- * angularjs-color-picker v0.8.0
2+ * angularjs-color-picker v0.8.1
33 * https://github.com/ruhley/angular-color-picker/
44 *
55 * Copyright 2015 ruhley
66 *
7- * 2015-12-30 09:16:44
7+ * 2016-01-11 08:39:01
88 *
99 */
1010if ( typeof module !== "undefined" && typeof exports !== "undefined" && module . exports === exports ) {
@@ -20,7 +20,7 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
2020( function ( ) {
2121 'use strict' ;
2222
23- var colorPicker = function ( $document , $timeout ) {
23+ var colorPicker = function ( $document ) {
2424 return {
2525 restrict : 'E' ,
2626 require : [ '^ngModel' ] ,
@@ -65,6 +65,10 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
6565 $document . on ( 'mousedown' , $scope . onMouseDown ) ;
6666 $document . on ( 'mouseup' , $scope . onMouseUp ) ;
6767 $document . on ( 'mousemove' , $scope . onMouseMove ) ;
68+
69+ $scope . find ( '.color-picker-grid' ) . on ( 'click' , $scope . onColorClick ) ;
70+ $scope . find ( '.color-picker-hue' ) . on ( 'click' , $scope . onHueClick ) ;
71+ $scope . find ( '.color-picker-opacity' ) . on ( 'click' , $scope . onOpacityClick ) ;
6872 } ;
6973
7074 $scope . onMouseDown = function ( event ) {
@@ -126,6 +130,24 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
126130 }
127131 } ;
128132
133+ $scope . onColorClick = function ( event ) {
134+ $scope . colorChange ( event ) ;
135+ $scope . $apply ( ) ;
136+ $scope . onChange ( event ) ;
137+ } ;
138+
139+ $scope . onHueClick = function ( event ) {
140+ $scope . hueChange ( event ) ;
141+ $scope . $apply ( ) ;
142+ $scope . onChange ( event ) ;
143+ } ;
144+
145+ $scope . onOpacityClick = function ( event ) {
146+ $scope . opacityChange ( event ) ;
147+ $scope . $apply ( ) ;
148+ $scope . onChange ( event ) ;
149+ } ;
150+
129151 $scope . onChange = function ( event ) {
130152 if ( $scope . ngModel !== $scope . onChangeValue ) {
131153 $scope . onChangeValue = $scope . ngModel ;
@@ -558,7 +580,7 @@ if (typeof module !== "undefined" && typeof exports !== "undefined" && module.ex
558580 } ;
559581 } ;
560582
561- colorPicker . $inject = [ '$document' , '$timeout' ] ;
583+ colorPicker . $inject = [ '$document' ] ;
562584
563585 angular . module ( 'color.picker' ) . directive ( 'colorPicker' , colorPicker ) ;
564586} ) ( ) ;
@@ -577,13 +599,13 @@ angular.module('color.picker').run(['$templateCache', function($templateCache) {
577599 ' \'color-picker-panel-bottom color-picker-panel-right\': config.pos === \'bottom right\',\n' +
578600 ' \'color-picker-panel-bottom color-picker-panel-left\': config.pos === \'bottom left\',\n' +
579601 ' }">\n' +
580- ' <div class="color-picker-hue color-picker-sprite" ng-click="hueChange($event)" >\n' +
602+ ' <div class="color-picker-hue color-picker-sprite">\n' +
581603 ' <div class="color-picker-slider" ng-attr-style="top: {{huePos}}%;"></div>\n' +
582604 ' </div>\n' +
583- ' <div class="color-picker-opacity color-picker-sprite" ng-show="config.alpha" ng-click="opacityChange($event)" >\n' +
605+ ' <div class="color-picker-opacity color-picker-sprite" ng-show="config.alpha">\n' +
584606 ' <div class="color-picker-slider" ng-attr-style="top: {{opacityPos}}%;"></div>\n' +
585607 ' </div>\n' +
586- ' <div class="color-picker-grid color-picker-sprite" ng-attr-style="background-color: {{grid}};" ng-click="colorChange($event)" >\n' +
608+ ' <div class="color-picker-grid color-picker-sprite" ng-attr-style="background-color: {{grid}};">\n' +
587609 ' <div class="color-picker-grid-inner"></div>\n' +
588610 ' <div class="color-picker-picker" ng-attr-style="top: {{lightnessPos}}%; left: {{saturationPos}}%;">\n' +
589611 ' <div></div>\n' +
0 commit comments