Revert modifications after discussion

This commit is contained in:
GMartigny 2016-03-05 17:23:25 +01:00
parent 9bd3bf4adf
commit 7088d9aa33
4 changed files with 8 additions and 30 deletions

View File

@ -13,7 +13,7 @@ License: MIT
*display: inline; *display: inline;
*zoom: 1; *zoom: 1;
/* https://github.com/bgrins/spectrum/issues/40 */ /* https://github.com/bgrins/spectrum/issues/40 */
z-index: 20000; z-index: 9999994;
overflow: hidden; overflow: hidden;
} }
.sp-container.sp-flat { .sp-container.sp-flat {

View File

@ -159,10 +159,3 @@
); );
} }
.palette-value-displayer{
color: #FFF;
text-align: center;
clear: both;
padding-top: 3px;
min-height: 1em;
}

View File

@ -1,9 +1,7 @@
(function () { (function () {
var ns = $.namespace('pskl.controller'); var ns = $.namespace('pskl.controller');
ns.PaletteController = function () { ns.PaletteController = function () {};
this.displayer = $('.palette-value-displayer');
};
/** /**
* @public * @public
@ -34,14 +32,12 @@
var colorPicker = $('#color-picker'); var colorPicker = $('#color-picker');
colorPicker.spectrum($.extend({color: Constants.DEFAULT_PEN_COLOR}, spectrumCfg)); colorPicker.spectrum($.extend({color: Constants.DEFAULT_PEN_COLOR}, spectrumCfg));
colorPicker.change({isPrimary : true}, $.proxy(this.onPickerChange_, this)); colorPicker.change({isPrimary : true}, $.proxy(this.onPickerChange_, this));
colorPicker.parent().mouseenter({isPrimary : true}, $.proxy(this.showValueDisplayer_, this)) this.setTitleOnPicker_(Constants.DEFAULT_PEN_COLOR, colorPicker);
.mouseleave($.proxy(this.hideValueDisplayer_, this));
var secondaryColorPicker = $('#secondary-color-picker'); var secondaryColorPicker = $('#secondary-color-picker');
secondaryColorPicker.spectrum($.extend({color: Constants.TRANSPARENT_COLOR}, spectrumCfg)); secondaryColorPicker.spectrum($.extend({color: Constants.TRANSPARENT_COLOR}, spectrumCfg));
secondaryColorPicker.change({isPrimary : false}, $.proxy(this.onPickerChange_, this)); secondaryColorPicker.change({isPrimary : false}, $.proxy(this.onPickerChange_, this));
secondaryColorPicker.parent().mouseenter({isPrimary : false}, $.proxy(this.showValueDisplayer_, this)) this.setTitleOnPicker_(Constants.TRANSPARENT_COLOR, secondaryColorPicker);
.mouseleave($.proxy(this.hideValueDisplayer_, this));
var swapColorsIcon = $('.swap-colors-button'); var swapColorsIcon = $('.swap-colors-button');
swapColorsIcon.click(this.swapColors.bind(this)); swapColorsIcon.click(this.swapColors.bind(this));
@ -110,21 +106,11 @@
} else { } else {
colorPicker.spectrum('set', color); colorPicker.spectrum('set', color);
} }
this.setTitleOnPicker_(color, colorPicker);
}; };
/** ns.PaletteController.prototype.setTitleOnPicker_ = function (title, colorPicker) {
* @private var spectrumInputSelector = '.sp-replacer';
*/ colorPicker.next(spectrumInputSelector).attr('title', title);
ns.PaletteController.prototype.showValueDisplayer_ = function (evt) {
var color = evt.data.isPrimary ?
pskl.app.selectedColorsService.getPrimaryColor() :
pskl.app.selectedColorsService.getSecondaryColor();
this.displayer.html(color);
};
/**
* @private
*/
ns.PaletteController.prototype.hideValueDisplayer_ = function (evt) {
this.displayer.html('');
}; };
})(); })();

View File

@ -33,7 +33,6 @@
rel="tooltip" rel="tooltip"
data-placement="right" data-placement="right"
></div> ></div>
<div class="palette-value-displayer"></div>
</div> </div>
</div> </div>
</div> </div>