JavaScript Graphics Library ( Draw and move interactive vector graphics easily in Javascript!

Disabled Fill (class jsgl.fill.DisabledFill)

Class jsgl.fill.DisabledFill is a special class allowing you to easily disable filling of elements.

By default, many JSGL elements come with default fill object, which is an jsgl.fill.SolidFill instance with color set to white:

var myRect = myPanel.createRectangle();
with(myRect.getStroke()) {

When the above code is applied to a panel with non-transparent background holder, by default, the result may look like:

Indeed, there are situations when you don't like the shape to be filled with the default white color. This is when jsgl.fill.DisableFill class becomes useful. You don't have to instantiate the class – you can use its singleton instance, which is accessible via jsgl.fill.DISABLED, together with the .setFill() method of a given element:


Then the result will look like:

Using jsgl.fill.DISABLED is the most straightforward way. Alternatively, however, you may use the .setEnabled() method of the default fill object to achieve the same result:

myRect = myPanel.createRectangle();

In this case, the fill object remains the same (along with all its properties), and can later be turned on again.

See Also

disabled-fill.txt · Last modified: 2013/03/14 03:16 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3
Driven by DokuWiki Powered by PHP Valid XHTML 1.0 Valid CSS