colorsquare.lzx
<library>
<include href="extensions/drawview.lzx"/>
<class name="colorsquare" extends="drawview">
<attribute name="swatchcolor" type="color" value="black
"/>
<attribute name="drawsquare" value="false
"/>
<handler name="oninit">
this.redraw();
</handler>
<handler name="oncontext">
this.redraw();
</handler>
<handler name="onswatchcolor">
this.redraw();
</handler>
<method name="redraw">
if(this.context){
this.clear();
if(this.drawsquare == true){
this.linewidth=0;
this.beginPath();
this.fillStyle = 0x333333;
this.moveTo(1,1);
this.lineTo(15,1);
this.lineTo(15,11);
this.lineTo(1,11);
this.lineTo(1,1);
this.fill();
this.beginPath();
this.fillStyle = 0xFFFFFF;
this.moveTo(0,0);
this.lineTo(14,0);
this.lineTo(14,10);
this.lineTo(0,10);
this.lineTo(0,0);
this.fill();
this.beginPath();
this.fillStyle = parseInt(swatchcolor);
this.moveTo(1,1);
this.lineTo(13,1);
this.lineTo(13,9);
this.lineTo(1,9);
this.lineTo(1,1);
this.fill();
}
}
</method>
</class>
</library>
Cross References
Includes
Classes