Added color picker.

This commit is contained in:
Devine Lu Linvega
2016-12-22 08:04:56 -07:00
parent c6b6d6a080
commit d28fcb7a60
6 changed files with 56 additions and 16 deletions

45
scripts/modules/eye.js Normal file
View 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);
}
}

View File

@@ -1,9 +0,0 @@
function Planner(rune)
{
Module.call(this,rune);
this.widget_cursor = function()
{
return "Planner";
}
}