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

Disabled Stroke (class jsgl.stroke.DisabledStroke)

Class jsgl.stroke.DisabledStroke is a special class that allows you to disabled painting outline of elements.

By default, many JSGL elements come with a default stroke object, which is an jsgl.stroke.SolidStroke instance of default properties, such as black color, 1px thickness etc.:

var myRect = myPanel.createRectangle();

The above code produces the following result. Notice the black outline of the rectangle:

In many cases, it is desirable to not paint any outline at all. This is when jsgl.stroke.DisabledStroke class is useful. You don't have the instantiate the class – you can the singleton instance, which is accessible via jsgl.stroke.DISABLED, together with the .setFill() method of a given element:


The result is then following (note that the black outline is missing):

Using the jsgl.stroke.DISABLED object is the most straightforward way to disable painting the outline.

Alternatively, you can turn off the stroke by keeping the default jsgl.stroke.SolidStroke by calling its .setEnabled() method:


The result of the above code is equivalent with the difference that the stroke object remains the same (along with all its properties), and can be turned on again later.

See Also

disabled-stroke.txt · Last modified: 2013/03/14 03:17 (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