Prev | Current Page 781 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The color tags can also be used to select a color using the
mouse.
Some untyped blocks have been introduced to bypass browser incompatibilities, as is the case of the
control text selection in the selectColor() function.
import js.Dom;
import ColorsUtil;
class RemoteColorSelector
{
private static var min = 1;
private static var serviceurl = ???colors.n???;
private var last : String;
private var input : Text;
private var eltags : HtmlDom;
private var elsampler : HtmlDom;
private var colors : Array < Color > ;
public function new(id : String)
{
input = cast js.Lib.document.getElementById(id);
createTagsContainer();
createColorSampler();
last = ?????™;
input.onkeyup = update;
}
private function update(e)
{
var ev = if(e == null) untyped window.event else e;
var text = input.value.toLowerCase();
if(text.length == 0 || text == last)
return;
// backspace and delete keys must not refresh the color selection
refreshTags(ev.keyCode == 8 || ev.keyCode == 46);
if(text.length < min)
return;
if(last == ?????™ || !StringTools.


Pages:
769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793