|
|
|
@ -11,6 +11,10 @@ |
|
|
|
|
var |
|
|
|
|
ids = {}, |
|
|
|
|
penFlag = true, |
|
|
|
|
tmpColor = { |
|
|
|
|
a:"", |
|
|
|
|
b:"" |
|
|
|
|
}, |
|
|
|
|
inAction, |
|
|
|
|
charMin = 65, |
|
|
|
|
visible, |
|
|
|
@ -108,7 +112,10 @@ |
|
|
|
|
}
|
|
|
|
|
setSelector(col, cal.get(0)); |
|
|
|
|
setHue(col, cal.get(0)); |
|
|
|
|
setNewColor(col, cal.get(0)); |
|
|
|
|
//setNewColor(col, cal.get(0));
|
|
|
|
|
$(cal.get(0)).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(col)); |
|
|
|
|
tmpColor.a = cal.get(0); |
|
|
|
|
tmpColor.b = col; |
|
|
|
|
cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]); |
|
|
|
|
}, |
|
|
|
|
blur = function (ev) { |
|
|
|
@ -182,6 +189,17 @@ |
|
|
|
|
current.preview = current.cal.data('colorpicker').livePreview;
|
|
|
|
|
$(document).bind('mouseup', current, upSelector); |
|
|
|
|
$(document).bind('mousemove', current, moveSelector); |
|
|
|
|
change.apply( |
|
|
|
|
current.cal.data('colorpicker') |
|
|
|
|
.fields |
|
|
|
|
.eq(6) |
|
|
|
|
.val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - current.pos.top))))/150, 10)) |
|
|
|
|
.end() |
|
|
|
|
.eq(5) |
|
|
|
|
.val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - current.pos.left))))/150, 10)) |
|
|
|
|
.get(0), |
|
|
|
|
[current.preview] |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
moveSelector = function (ev) { |
|
|
|
|
change.apply( |
|
|
|
@ -202,6 +220,18 @@ |
|
|
|
|
fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); |
|
|
|
|
$(document).unbind('mouseup', upSelector); |
|
|
|
|
$(document).unbind('mousemove', moveSelector); |
|
|
|
|
if(penFlag){ |
|
|
|
|
$("div.tools_change").removeClass("tools_compass"); |
|
|
|
|
window.sankore.setTool('pen'); |
|
|
|
|
window.sankore.setPenColor('#' + HSBToHex(tmpColor.b)); |
|
|
|
|
sankore.returnStatus("PEN installed", penFlag); |
|
|
|
|
} else { |
|
|
|
|
$("div.tools_change").addClass("tools_compass"); |
|
|
|
|
window.sankore.setTool('compass'); |
|
|
|
|
window.sankore.setPenColor('#' + HSBToHex(tmpColor.b)); |
|
|
|
|
sankore.returnStatus("Compass installed", penFlag); |
|
|
|
|
} |
|
|
|
|
//$(tmpColor.a).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(tmpColor.b));
|
|
|
|
|
return false; |
|
|
|
|
}, |
|
|
|
|
enterSubmit = function (ev) { |
|
|
|
@ -433,6 +463,9 @@ |
|
|
|
|
HSBToHex = function (hsb) { |
|
|
|
|
return RGBToHex(HSBToRGB(hsb)); |
|
|
|
|
}, |
|
|
|
|
// changeCursor = function (flag) {
|
|
|
|
|
// alert(flag)
|
|
|
|
|
// },
|
|
|
|
|
restoreOriginal = function () { |
|
|
|
|
var cal = $(this).parent(); |
|
|
|
|
var col = cal.data('colorpicker').origColor; |
|
|
|
@ -446,6 +479,15 @@ |
|
|
|
|
}; |
|
|
|
|
return { |
|
|
|
|
init: function (opt) { |
|
|
|
|
if(window.sankore) |
|
|
|
|
sankore.setTool("arrow");
|
|
|
|
|
// $(document).mouseout(function(event){
|
|
|
|
|
// if(event.target.tagName == "DIV" && event.target.className == "colorpicker")
|
|
|
|
|
// changeCursor(true)
|
|
|
|
|
// })
|
|
|
|
|
// $("body").mouseleave(function(){
|
|
|
|
|
// changeCursor(true)
|
|
|
|
|
// })
|
|
|
|
|
opt = $.extend({}, defaults, opt||{}); |
|
|
|
|
if (typeof opt.color == 'string') { |
|
|
|
|
opt.color = HexToHSB(opt.color); |
|
|
|
@ -465,9 +507,13 @@ |
|
|
|
|
var cal = $(tpl).attr('id', id); |
|
|
|
|
if (options.flat) { |
|
|
|
|
cal.appendTo(this).show(); |
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
cal.appendTo(document.body); |
|
|
|
|
} |
|
|
|
|
// cal.bind("mouseover", function(){
|
|
|
|
|
// window.sankore.setTool('arrow');
|
|
|
|
|
// })
|
|
|
|
|
options.fields = cal |
|
|
|
|
.find('input') |
|
|
|
|
.bind('keyup', keyDown) |
|
|
|
|