|
1 | 1 | /*! |
2 | | - * angularjs-color-picker v3.4.7 |
| 2 | + * angularjs-color-picker v3.4.8 |
3 | 3 | * https://github.com/ruhley/angular-color-picker/ |
4 | 4 | * |
5 | 5 | * Copyright 2017 ruhley |
6 | 6 | * |
7 | | - * 2017-09-25 18:00:22 |
| 7 | + * 2017-10-06 09:51:57 |
8 | 8 | * |
9 | 9 | */ |
10 | 10 |
|
@@ -287,7 +287,7 @@ var AngularColorPickerController = function () { |
287 | 287 | } |
288 | 288 | }); |
289 | 289 |
|
290 | | - this.$scope.$watchGroup(['AngularColorPickerController.options.format', 'AngularColorPickerController.options.alpha', 'AngularColorPickerController.options.case', 'AngularColorPickerController.options.round', 'AngularColorPickerController.options.restrictToFormat', 'AngularColorPickerController.options.preserveInputFormat', 'AngularColorPickerController.options.allowEmpty', 'AngularColorPickerController.options.horizontal'], function (newValue) { |
| 290 | + this.$scope.$watchGroup(['AngularColorPickerController.options.format', 'AngularColorPickerController.options.alpha', 'AngularColorPickerController.options.case', 'AngularColorPickerController.options.round', 'AngularColorPickerController.options.restrictToFormat', 'AngularColorPickerController.options.preserveInputFormat', 'AngularColorPickerController.options.allowEmpty', 'AngularColorPickerController.options.horizontal', 'AngularColorPickerController.options.dynamicHue', 'AngularColorPickerController.options.dynamicSaturation', 'AngularColorPickerController.options.dynamicLightness', 'AngularColorPickerController.options.dynamicAlpha'], function (newValue) { |
291 | 291 | if (newValue !== undefined) { |
292 | 292 | _this.initConfig(); |
293 | 293 | _this.update(); |
@@ -829,13 +829,13 @@ var AngularColorPickerController = function () { |
829 | 829 | var el = this.find('.color-picker-hue .color-picker-overlay'); |
830 | 830 | var direction = this.options.horizontal ? 'left' : 'top'; |
831 | 831 |
|
832 | | - var zero_sixths = this.getColorValue(); |
833 | | - var one_sixths = this.getColorValue(); |
834 | | - var two_sixths = this.getColorValue(); |
835 | | - var three_sixths = this.getColorValue(); |
836 | | - var four_sixths = this.getColorValue(); |
837 | | - var five_sixths = this.getColorValue(); |
838 | | - var six_sixths = this.getColorValue(); |
| 832 | + var zero_sixths = this.getColorValue(this.options.dynamicHue); |
| 833 | + var one_sixths = this.getColorValue(this.options.dynamicHue); |
| 834 | + var two_sixths = this.getColorValue(this.options.dynamicHue); |
| 835 | + var three_sixths = this.getColorValue(this.options.dynamicHue); |
| 836 | + var four_sixths = this.getColorValue(this.options.dynamicHue); |
| 837 | + var five_sixths = this.getColorValue(this.options.dynamicHue); |
| 838 | + var six_sixths = this.getColorValue(this.options.dynamicHue); |
839 | 839 |
|
840 | 840 | zero_sixths.h = 0; |
841 | 841 | one_sixths.h = 60; |
@@ -886,11 +886,11 @@ var AngularColorPickerController = function () { |
886 | 886 | value: function updateSaturationBackground(color) { |
887 | 887 | var el = this.find('.color-picker-saturation .color-picker-overlay'); |
888 | 888 | var direction = this.options.horizontal ? 'right' : 'bottom'; |
889 | | - var high = this.getColorValue(); |
890 | | - var low = this.getColorValue(); |
| 889 | + var high = this.getColorValue(this.options.dynamicSaturation); |
| 890 | + var low = this.getColorValue(this.options.dynamicSaturation); |
891 | 891 |
|
892 | | - high.s = 100; |
893 | | - low.s = 0; |
| 892 | + high.s = '100%'; |
| 893 | + low.s = '0%'; |
894 | 894 |
|
895 | 895 | el.css({ |
896 | 896 | 'background': 'linear-gradient(to ' + direction + ', ' + tinycolor(high).toRgbString() + ' 0%, ' + tinycolor(low).toRgbString() + ' 100%)' |
@@ -933,9 +933,9 @@ var AngularColorPickerController = function () { |
933 | 933 | value: function updateLightnessBackground(color) { |
934 | 934 | var el = this.find('.color-picker-lightness .color-picker-overlay'); |
935 | 935 | var direction = this.options.horizontal ? 'right' : 'bottom'; |
936 | | - var bright = this.getColorValue(); |
937 | | - var middle = this.getColorValue(); |
938 | | - var dark = this.getColorValue(); |
| 936 | + var bright = this.getColorValue(this.options.dynamicLightness); |
| 937 | + var middle = this.getColorValue(this.options.dynamicLightness); |
| 938 | + var dark = this.getColorValue(this.options.dynamicLightness); |
939 | 939 |
|
940 | 940 | if (this.options.round) { |
941 | 941 | bright.l = 100; |
@@ -978,8 +978,8 @@ var AngularColorPickerController = function () { |
978 | 978 | value: function updateOpacityBackground(color) { |
979 | 979 | var el = this.find('.color-picker-opacity .color-picker-overlay'); |
980 | 980 | var direction = this.options.horizontal ? 'right' : 'bottom'; |
981 | | - var opaque = this.getColorValue(); |
982 | | - var transparent = this.getColorValue(); |
| 981 | + var opaque = this.getColorValue(this.options.dynamicAlpha); |
| 982 | + var transparent = this.getColorValue(this.options.dynamicAlpha); |
983 | 983 |
|
984 | 984 | opaque.a = 1; |
985 | 985 | transparent.a = 0; |
@@ -1060,10 +1060,10 @@ var AngularColorPickerController = function () { |
1060 | 1060 | var background = this.getColorValue(); |
1061 | 1061 |
|
1062 | 1062 | if (this.options.round) { |
1063 | | - background.s = 0; |
| 1063 | + background.s = '0%'; |
1064 | 1064 | } else { |
1065 | | - background.s = 1; |
1066 | | - background.v = 1; |
| 1065 | + background.s = '100%'; |
| 1066 | + background.v = '100%'; |
1067 | 1067 | background.a = 1; |
1068 | 1068 | } |
1069 | 1069 |
|
@@ -1131,24 +1131,25 @@ var AngularColorPickerController = function () { |
1131 | 1131 | }, { |
1132 | 1132 | key: 'getColorValue', |
1133 | 1133 | value: function getColorValue() { |
1134 | | - var includeOpacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; |
| 1134 | + var dynamicValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; |
| 1135 | + var includeOpacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; |
1135 | 1136 |
|
1136 | 1137 | var value = { |
1137 | 1138 | h: this.hue, |
1138 | | - s: this.saturation + '%', |
1139 | | - v: this.lightness + '%' |
| 1139 | + s: dynamicValues ? this.saturation + '%' : '100%', |
| 1140 | + v: dynamicValues ? this.lightness + '%' : '100%' |
1140 | 1141 | }; |
1141 | 1142 |
|
1142 | 1143 | if (this.options.round) { |
1143 | 1144 | value = { |
1144 | 1145 | h: this.hue, |
1145 | | - s: this.saturation + '%', |
1146 | | - l: this.lightness + '%' |
| 1146 | + s: dynamicValues ? this.saturation + '%' : '100%', |
| 1147 | + l: dynamicValues ? this.lightness + '%' : '50%' |
1147 | 1148 | }; |
1148 | 1149 | } |
1149 | 1150 |
|
1150 | 1151 | if (includeOpacity) { |
1151 | | - value.a = this.opacity / 100; |
| 1152 | + value.a = dynamicValues ? this.opacity / 100 : 1; |
1152 | 1153 | } |
1153 | 1154 |
|
1154 | 1155 | return value; |
@@ -1422,10 +1423,15 @@ var AngularColorPickerOptions = function AngularColorPickerOptions() { |
1422 | 1423 | // color |
1423 | 1424 | format: 'hsl', |
1424 | 1425 | case: 'upper', |
| 1426 | + // sliders |
1425 | 1427 | hue: true, |
1426 | 1428 | saturation: false, |
1427 | 1429 | lightness: false, |
1428 | 1430 | alpha: true, |
| 1431 | + dynamicHue: true, |
| 1432 | + dynamicSaturation: true, |
| 1433 | + dynamicLightness: true, |
| 1434 | + dynamicAlpha: true, |
1429 | 1435 | // picker |
1430 | 1436 | round: false, |
1431 | 1437 | pos: 'bottom left', |
|
0 commit comments