Download oCanvas

Source files

To use oCanvas in your projects, just download the file from here. The production version is minified, which is great for production, but for development you might want the uncompressed source to easily find errors in your code.

Note: Please do not hotlink directly to the files hosted on ocanvas.org. Either link to the CDN version, or download local copies.

Bug reporting

Errors might happen, and they can sometimes point to the oCanvas source. Most often it is because of bad input data, and by using the development version of oCanvas you can see what part of oCanvas that gets an error, and that can make it easier for you to spot your error. If you really think you've found a bug in oCanvas, please report the issue on GitHub.

Browser support

oCanvas should work in most modern browsers with canvas support. With the release of version 2.0.0, Internet Explorer 9 and above is also supported. Touch devices such as iPhone and iPad are also supported. Android devices will probably work, but are not tested.

Bug fixes

New features

Add a better way to create pie chart sections, using the property pieSection.

Add support for specifying text line-height in pixels, instead of only a relative unit. It will work both in the short-hand font property ("12px/18px sans-serif") and as a property (text.lineHeight = "18px").

Bug fixes

Clear background completely on redraw. If the background was set to a transparent color, you would see that it wasn't really cleared before.

Fix incorrect color parsing for strokes. If a stroke value contained a gradient with color stop positions set, or where the colors within the gradient contained spaces, it would be parsed incorrectly.

New features

The core instance now has a children property just like display objects. All objects added directly to the core instance will have their parent property set to the core instance.

The dragAndDrop method will now accept the property bubble in its options object. If bubble is set to false, the events the method is using will stop propagating further out.

Display objects now have a property called added, which is true if the object has been added to another object. This does not mean it is going to be drawn. The property drawn is for checking that.

The draw module has a new property called isCleared. That will be true if the clear method has been called, and will be set to false again when the next redraw happens.

Bug fixes

The draw order mechanism has been refactored which will make zIndex behave more natural. Objects added as children to another object with a low zIndex, will never be drawn above objects with a higher zIndex. This also means the zIndex values are local to the parent's children, not the global draw stack.

Setting width or height of an object will no longer affect the width/height of its children. Scaling is used for this effect instead.

Touch positions are now correctly calculated when the page is scrolled.

Deprecated features

Property objects in the draw module is now deprecated due to the new structure of draw order mentioned above. It will be removed in the next major release.