Skip to content

Commit 8d846db

Browse files
committed
Bumping to v2.3.0
1 parent 935f744 commit 8d846db

10 files changed

+63
-29
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## v2.3.0
4+
5+
#### Breaking Changes
6+
* None
7+
8+
#### New Features
9+
* New `round` option to show a round color picker
10+
11+
#### Bug Fixes
12+
* None
13+
314
## v2.2.0
415

516
#### Breaking Changes

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ $scope.color = '#FF0000';
7272
// options - if a list is given then choose one of the items. The first item in the list will be the default
7373
$scope.options = {
7474
disabled: [false, true],
75+
round: [false, true],
7576
format: ['hsl', 'hsv', 'rgb', 'hex', 'hex8'],
7677
hue: [true, false],
7778
alpha: [true, false],

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angular-color-picker",
33
"description": "Color Picker Directive For AngularJS",
4-
"version": "2.2.0",
4+
"version": "2.3.0",
55
"homepage": "https://github.com/ruhley/angular-color-picker",
66
"repository": {
77
"type": "git",

dist/angularjs-color-picker.css

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angularjs-color-picker.js

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*!
2-
* angularjs-color-picker v2.1.7
2+
* angularjs-color-picker v2.3.0
33
* https://github.com/ruhley/angular-color-picker/
44
*
55
* Copyright 2016 ruhley
66
*
7-
* 2016-07-26 12:23:44
7+
* 2016-07-29 09:30:27
88
*
99
*/
1010

@@ -239,7 +239,7 @@
239239

240240
this.$scope.$watchGroup(['AngularColorPickerController.options.format', 'AngularColorPickerController.options.alpha', 'AngularColorPickerController.options.case'], this.reInitAndUpdate.bind(this));
241241

242-
this.$scope.$watchGroup(['AngularColorPickerController.options.disabled', 'AngularColorPickerController.options.swatchBootstrap', 'AngularColorPickerController.options.swatchOnly', 'AngularColorPickerController.options.swatch', 'AngularColorPickerController.options.pos', 'AngularColorPickerController.options.inline', 'AngularColorPickerController.options.placeholder'], this.reInit.bind(this));
242+
this.$scope.$watchGroup(['AngularColorPickerController.options.disabled', 'AngularColorPickerController.options.swatchBootstrap', 'AngularColorPickerController.options.swatchOnly', 'AngularColorPickerController.options.swatch', 'AngularColorPickerController.options.pos', 'AngularColorPickerController.options.inline', 'AngularColorPickerController.options.placeholder', 'AngularColorPickerController.options.round'], this.reInit.bind(this));
243243

244244
// api
245245

@@ -447,6 +447,10 @@
447447
});
448448

449449
this.visible = this.options.inline;
450+
451+
if (this.options.round) {
452+
this.options.hue = false;
453+
}
450454
}
451455
}, {
452456
key: 'merge',
@@ -579,9 +583,11 @@
579583
var el = angular.element(_this7.$element[0].querySelector('.color-picker-grid .color-picker-picker'));
580584
var bounding = container.getBoundingClientRect();
581585

582-
el.css({
583-
'top': bounding.height * _this7.lightnessPos / 100 + 'px'
584-
});
586+
if (!_this7.options.round) {
587+
el.css({
588+
'top': bounding.height * _this7.lightnessPos / 100 + 'px'
589+
});
590+
}
585591
});
586592
}
587593
}, {
@@ -609,7 +615,6 @@
609615
}, {
610616
key: 'gridUpdate',
611617
value: function gridUpdate() {
612-
if (!this.options.updateBackgroundColor) return;
613618
var el = angular.element(this.$element[0].querySelector('.color-picker-grid'));
614619

615620
el.css({
@@ -761,7 +766,9 @@
761766

762767
this.saturation = 100 * tmpSaturation;
763768
var degHue = tmpHue * 57.29577951308233; // rad to deg
764-
if (degHue < 0.0) degHue += 360.0;
769+
if (degHue < 0.0) {
770+
degHue += 360.0;
771+
}
765772
this.hue = degHue;
766773
this.lightness = 100;
767774
} else {
@@ -792,6 +799,21 @@
792799

793800
this.xPos = (px + 100.0) * 0.5;
794801
this.yPos = (py + 100.0) * 0.5;
802+
803+
// because we are using percentages this can be half of 100%
804+
var center = 50;
805+
// distance of pointer from the center of the circle
806+
var distance = Math.pow(center - this.xPos, 2) + Math.pow(center - this.yPos, 2);
807+
// distance of edge of circle from the center of the circle
808+
var radius = Math.pow(center, 2);
809+
810+
// if not inside the circle
811+
if (distance > radius) {
812+
var rads = Math.atan2(this.yPos - center, this.xPos - center);
813+
814+
this.xPos = Math.cos(rads) * center + center;
815+
this.yPos = Math.sin(rads) * center + center;
816+
}
795817
} else {
796818
this.saturationPos = this.saturation / 100 * 100;
797819

@@ -946,8 +968,9 @@
946968
}
947969

948970
function template($templateCache) {
949-
$templateCache.put('template/color-picker/directive.html', '<div class="color-picker-wrapper" ng-class="{' + '\'color-picker-disabled\': AngularColorPickerController.options.disabled,' + '\'color-picker-swatch-only\': AngularColorPickerController.options.swatchOnly,' + '}">' + ' <div class="color-picker-input-wrapper" ng-class="{\'input-group\': AngularColorPickerController.options.swatchBootstrap && AngularColorPickerController.options.swatch}">' + ' <span ng-if="AngularColorPickerController.options.swatchPos === \'left\'" class="color-picker-swatch" ng-click="AngularColorPickerController.focus()" ng-show="AngularColorPickerController.options.swatch" ng-class="{\'color-picker-swatch-left\': AngularColorPickerController.options.swatchPos !== \'right\', \'color-picker-swatch-right\': AngularColorPickerController.options.swatchPos === \'right\', \'input-group-addon\': AngularColorPickerController.options.swatchBootstrap}"></span>' + ' <input class="color-picker-input form-control" type="text" ng-model="AngularColorPickerController.ngModel" ng-readonly="AngularColorPickerController.options.swatchOnly" ng-disabled="AngularColorPickerController.options.disabled" ng-blur="AngularColorPickerController.onBlur($event)" ng-change="AngularColorPickerController.onChange($event)" size="7" ng-focus="AngularColorPickerController.api.open($event)" ng-class="{\'color-picker-input-swatch\': AngularColorPickerController.options.swatch && !AngularColorPickerController.options.swatchOnly && AngularColorPickerController.options.swatchPos === \'left\'}" placeholder="{{AngularColorPickerController.options.placeholder}}">' + ' <span ng-if="AngularColorPickerController.options.swatchPos === \'right\'" class="color-picker-swatch" ng-click="AngularColorPickerController.focus()" ng-show="AngularColorPickerController.options.swatch" ng-class="{\'color-picker-swatch-left\': AngularColorPickerController.options.swatchPos !== \'right\', \'color-picker-swatch-right\': AngularColorPickerController.options.swatchPos === \'right\', \'input-group-addon\': AngularColorPickerController.options.swatchBootstrap}"></span>' + ' </div>' + ' <div class="color-picker-panel" ng-show="AngularColorPickerController.visible" ng-class="{' + ' \'color-picker-panel-top color-picker-panel-right\': AngularColorPickerController.options.pos === \'top right\',' + ' \'color-picker-panel-top color-picker-panel-left\': AngularColorPickerController.options.pos === \'top left\',' + ' \'color-picker-panel-bottom color-picker-panel-right\': AngularColorPickerController.options.pos === \'bottom right\',' + ' \'color-picker-panel-bottom color-picker-panel-left\': AngularColorPickerController.options.pos === \'bottom left\',' + ' \'color-picker-panel-round\': AngularColorPickerController.options.round,' + ' \'color-picker-show-hue\': AngularColorPickerController.options.hue,' + ' \'color-picker-show-alpha\': AngularColorPickerController.options.alpha && AngularColorPickerController.options.format !== \'hex\',' + ' \'color-picker-show-inline\': AngularColorPickerController.options.inline,' + ' }">' + ' <div class="color-picker-grid-wrapper">' + ' <div class="color-picker-row">' + ' <div class="color-picker-grid color-picker-sprite">' + ' <div class="color-picker-grid-inner"></div>' + ' <div class="color-picker-picker">' + ' <div></div>' + ' </div>' + ' </div>' + ' <div class="color-picker-hue color-picker-sprite" ng-show="AngularColorPickerController.options.hue">' + ' <div class="color-picker-slider"></div>' + ' </div>' + ' <div class="color-picker-opacity color-picker-sprite" ng-show="AngularColorPickerController.options.alpha && AngularColorPickerController.options.format !== \'hex\'">' + ' <div class="color-picker-slider"></div>' + ' </div>' + ' </div>' + ' </div>' + ' <div class="color-picker-actions">' + ' <button ' + ' class="color-picker-action color-picker-action-clear"' + ' ng-class="AngularColorPickerController.options.clear.class"' + ' ng-show="AngularColorPickerController.options.clear.show"' + ' ng-click="AngularColorPickerController.api.clear($event)"' + ' >' + ' {{AngularColorPickerController.options.clear.label}}' + ' </button><!--' + ' --><button ' + ' class="color-picker-action color-picker-action-reset"' + ' ng-class="AngularColorPickerController.options.reset.class"' + ' ng-show="AngularColorPickerController.options.reset.show"' + ' ng-click="AngularColorPickerController.api.reset($event)"' + ' >' + ' {{AngularColorPickerController.options.reset.label}}' + ' </button><!--' + ' --><button' + ' class="color-picker-action color-picker-action-close"' + ' ng-class="AngularColorPickerController.options.close.class"' + ' ng-show="AngularColorPickerController.options.close.show"' + ' ng-click="AngularColorPickerController.api.close($event)"' + ' >' + ' {{AngularColorPickerController.options.close.label}}' + ' </button>' + ' </div>' + ' </div>' + '</div>');
950-
};
971+
$templateCache.put('template/color-picker/directive.html', '<div class="color-picker-wrapper" ng-class="{' + '\'color-picker-disabled\': AngularColorPickerController.options.disabled,' + '\'color-picker-swatch-only\': AngularColorPickerController.options.swatchOnly,' + '}">' + ' <div class="color-picker-input-wrapper" ng-class="{\'input-group\': AngularColorPickerController.options.swatchBootstrap && AngularColorPickerController.options.swatch}">' + ' <span ng-if="AngularColorPickerController.options.swatchPos === \'left\'" class="color-picker-swatch" ng-click="AngularColorPickerController.focus()" ng-show="AngularColorPickerController.options.swatch" ng-class="{\'color-picker-swatch-left\': AngularColorPickerController.options.swatchPos !== \'right\', \'color-picker-swatch-right\': AngularColorPickerController.options.swatchPos === \'right\', \'input-group-addon\': AngularColorPickerController.options.swatchBootstrap}"></span>' + ' <input class="color-picker-input form-control" type="text" ng-model="AngularColorPickerController.ngModel" ng-readonly="AngularColorPickerController.options.swatchOnly" ng-disabled="AngularColorPickerController.options.disabled" ng-blur="AngularColorPickerController.onBlur($event)" ng-change="AngularColorPickerController.onChange($event)" size="7" ng-focus="AngularColorPickerController.api.open($event)" ng-class="{\'color-picker-input-swatch\': AngularColorPickerController.options.swatch && !AngularColorPickerController.options.swatchOnly && AngularColorPickerController.options.swatchPos === \'left\'}" placeholder="{{AngularColorPickerController.options.placeholder}}">' + ' <span ng-if="AngularColorPickerController.options.swatchPos === \'right\'" class="color-picker-swatch" ng-click="AngularColorPickerController.focus()" ng-show="AngularColorPickerController.options.swatch" ng-class="{\'color-picker-swatch-left\': AngularColorPickerController.options.swatchPos !== \'right\', \'color-picker-swatch-right\': AngularColorPickerController.options.swatchPos === \'right\', \'input-group-addon\': AngularColorPickerController.options.swatchBootstrap}"></span>' + ' </div>' + ' <div class="color-picker-panel" ng-show="AngularColorPickerController.visible" ng-class="{' + ' \'color-picker-panel-top color-picker-panel-right\': AngularColorPickerController.options.pos === \'top right\',' + ' \'color-picker-panel-top color-picker-panel-left\': AngularColorPickerController.options.pos === \'top left\',' + ' \'color-picker-panel-bottom color-picker-panel-right\': AngularColorPickerController.options.pos === \'bottom right\',' + ' \'color-picker-panel-bottom color-picker-panel-left\': AngularColorPickerController.options.pos === \'bottom left\',' + ' \'color-picker-panel-round\': AngularColorPickerController.options.round,' + ' \'color-picker-show-hue\': AngularColorPickerController.options.hue,' + ' \'color-picker-show-alpha\': AngularColorPickerController.options.alpha && AngularColorPickerController.options.format !== \'hex\',' + ' \'color-picker-show-inline\': AngularColorPickerController.options.inline,' + ' }">' + ' <div class="color-picker-grid-wrapper">' + ' <div class="color-picker-row">' + ' <div class="color-picker-grid color-picker-sprite">' + ' <div class="color-picker-grid-inner"></div>' + ' <div class="color-picker-picker">' + ' <div></div>' + ' </div>' + ' </div>' + ' <div class="color-picker-hue color-picker-sprite" ng-show="AngularColorPickerController.options.hue">' + ' <div class="color-picker-slider"></div>' + ' </div>' + ' <div class="color-picker-opacity color-picker-sprite" ng-show="AngularColorPickerController.options.alpha && AngularColorPickerController.options.format !== \'hex\'">' + ' <div class="color-picker-slider"></div>' + ' </div>' + ' </div>' + ' </div>' + ' <div class="color-picker-actions">' + ' <button ' + ' class="color-picker-action color-picker-action-clear"' + ' ng-class="AngularColorPickerController.options.clear.class"' + ' ng-show="AngularColorPickerController.options.clear.show"' + ' ng-click="AngularColorPickerController.api.clear($event)"' + ' >' + ' {{AngularColorPickerController.options.clear.label}}' + ' </button><!--' + ' --><button ' + ' class="color-picker-action color-picker-action-reset"' + ' ng-class="AngularColorPickerController.options.reset.class"' + ' ng-show="AngularColorPickerController.options.reset.show"' + ' ng-click="AngularColorPickerController.api.reset($event)"' + ' >' + ' {{AngularColorPickerController.options.reset.label}}' + ' </button><!--' + ' --><button' + ' class="color-picker-action color-picker-action-close"' + ' ng-class="AngularColorPickerController.options.close.class"' + ' ng-show="AngularColorPickerController.options.close.show"' + ' ng-click="AngularColorPickerController.api.close($event)"' + ' >' + ' {{AngularColorPickerController.options.close.label}}' + ' </button>' + ' </div>' + ' </div>' + '</div>');
972+
}
973+
951974
template.$inject = ['$templateCache'];
952975

953976
var colorPicker = angular.module('color.picker', []).directive('colorPicker', colorPickerDirective).run(template);

dist/angularjs-color-picker.min.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angularjs-color-picker.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/themes/angularjs-color-picker-bootstrap.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*!
2-
* angularjs-color-picker v2.1.7
2+
* angularjs-color-picker v2.3.0
33
* https://github.com/ruhley/angular-color-picker/
44
*
55
* Copyright 2016 ruhley
66
*
7-
* 2016-07-26 12:23:44
7+
* 2016-07-29 09:30:30
88
*
99
*/
1010
.color-picker-wrapper .color-picker-input-wrapper {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*!
2-
* angularjs-color-picker v2.1.7
2+
* angularjs-color-picker v2.3.0
33
* https://github.com/ruhley/angular-color-picker/
44
*
55
* Copyright 2016 ruhley
66
*
7-
* 2016-07-26 12:23:44
7+
* 2016-07-29 09:30:30
88
*
99
*/.color-picker-wrapper .color-picker-input-wrapper{width:100%}.color-picker-wrapper .color-picker-swatch:not(.input-group-addon){height:28px}.color-picker-wrapper.color-picker-swatch-only .input-group .input-group-addon{border-radius:4px}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angularjs-color-picker",
33
"description": "Color Picker Directive For AngularJS",
4-
"version": "2.2.0",
4+
"version": "2.3.0",
55
"license": "MIT",
66
"main": "dist/angularjs-color-picker.min.js",
77
"dependencies": {

0 commit comments

Comments
 (0)