Added color picker.
This commit is contained in:
45
scripts/modules/eye.js
Normal file
45
scripts/modules/eye.js
Normal file
@@ -0,0 +1,45 @@
|
||||
function Eye(rune)
|
||||
{
|
||||
Module.call(this,rune);
|
||||
|
||||
// Module
|
||||
|
||||
this.active = function(cmd)
|
||||
{
|
||||
}
|
||||
|
||||
this.passive = function(cmd)
|
||||
{
|
||||
}
|
||||
|
||||
this.widget_cursor = function()
|
||||
{
|
||||
return "Eye";
|
||||
}
|
||||
|
||||
this.color_picker = function(position)
|
||||
{
|
||||
var imgData = ronin.canvas.context().getImageData(position.x, position.y, 1, 1).data;
|
||||
var c = new Color();
|
||||
commander.show();
|
||||
commander.element_input.focus();
|
||||
commander.element_input.value = "> "+(c.rgb_to_hex(imgData));
|
||||
}
|
||||
|
||||
// Cursor
|
||||
|
||||
this.mouse_down = function(position)
|
||||
{
|
||||
this.color_picker(position);
|
||||
}
|
||||
|
||||
this.mouse_move = function(position)
|
||||
{
|
||||
this.color_picker(position);
|
||||
}
|
||||
|
||||
this.mouse_up = function(position)
|
||||
{
|
||||
this.color_picker(position);
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
function Planner(rune)
|
||||
{
|
||||
Module.call(this,rune);
|
||||
|
||||
this.widget_cursor = function()
|
||||
{
|
||||
return "Planner";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user