From 8844b46dec5f36de04c1fc3a1b1b4d00e726a067 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 13 Mar 2012 13:20:28 -0700 Subject: Gradient stop logic Made logic changes to allow for a minimum number of gradients to remain at 2 at all times and not apply default colors. --- .../gradientpicker.reel/gradientpicker.js | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'js') diff --git a/js/components/gradientpicker.reel/gradientpicker.js b/js/components/gradientpicker.reel/gradientpicker.js index da4e8c0f..b10f6624 100755 --- a/js/components/gradientpicker.reel/gradientpicker.js +++ b/js/components/gradientpicker.reel/gradientpicker.js @@ -213,21 +213,13 @@ exports.GradientPicker = Montage.create(Component, { removeStop: { enumerable: false, value: function(stop) { - //Removing stops - this.element._components.stopsContainer.removeChild(stop); - //Stopping events related to this current stop - this.removeStopMoving(); - //Resetting stops if less than 2 var i, buttons = this.element._components.stopsContainer.getElementsByTagName('button'); - if (buttons.length < 2) { - //Removing remaining stops prior to resetting - for (i=0; buttons[i]; i++) { - this.element._components.stopsContainer.removeChild(buttons[i].stop); - } - //Nulling then adding defaults - this.value = null; - this.addDefaultStops(); - this._dispatchEvent('change', false); + // + if (buttons.length > 2) { + //Removing stops + this.element._components.stopsContainer.removeChild(stop); + //Stopping events related to this current stop + this.removeStopMoving(); } } }, @@ -327,7 +319,7 @@ exports.GradientPicker = Montage.create(Component, { // this.application.ninja.colorController.colorPopupManager.hideColorChipPopup(); // - if ((e._event.y+this.hack.y) > this.element._trackY+50 || (e._event.y+this.hack.y) < this.element._trackY) { + if ((e._event.y+this.hack.y) > this.element._trackY+70 || (e._event.y+this.hack.y) < this.element._trackY) { this.removeStop(this.currentStop); } // -- cgit v1.2.3