Skip to content

Commit

Permalink
fix(colorPicker): Fix init logic in [email protected] and lower
Browse files Browse the repository at this point in the history
  • Loading branch information
rkunev committed Apr 21, 2017
1 parent 9dbb2c7 commit 8927deb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/color-picker.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,16 @@
knob.addEventListener('transitionend', _onKnobTransitionEnd);
ripple.addEventListener('animationend', _onRippleAnimationEnd);
palette.addEventListener('transitionend', _onPaletteTransitionEnd);

// @fix angular < 1.5.4 doesn't trigger $onChanges properly on init
$onChanges.call(this);
}

function $onChanges() {
if (this.color && 'red' in this.color && 'green' in this.color && 'blue' in this.color) {
this.angle = ColorPickerService.rgbToHsl(this.color.red, this.color.green, this.color.blue).hue;
} else {
this.angle = 0;
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/color-picker.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,16 @@
knob.addEventListener('transitionend', _onKnobTransitionEnd);
ripple.addEventListener('animationend', _onRippleAnimationEnd);
palette.addEventListener('transitionend', _onPaletteTransitionEnd);

// @fix angular < 1.5.4 doesn't trigger $onChanges properly on init
$onChanges.call(this);
}

function $onChanges() {
if (this.color && 'red' in this.color && 'green' in this.color && 'blue' in this.color) {
this.angle = ColorPickerService.rgbToHsl(this.color.red, this.color.green, this.color.blue).hue;
} else {
this.angle = 0;
}
}

Expand Down

0 comments on commit 8927deb

Please sign in to comment.