Support

Need something?

License

jCanvas is licensed under the MIT license. This means you can use jCanvas for whatever purpose under two conditions:

You can read the full license on GitHub.

Frequently Asked Questions

Why are my jCanvas shapes mispositioned?

By default, jCanvas considers a shape’s center at its (x, y) position. You can change this behavior using the fromCenter property, which will measure a shape’s (x, y) from its top-left corner.

For consistency, the same behavior applies when cropping an image, which also can be reverted using the cropFromCenter property.

It is also important to note that for numerical jCanvas properties such as x, y, height, strokeWidth, etc., jCanvas requires that their respective values be numbers, not strings.

Why are my layers reappearing after calling clearCanvas()?

The clearCanvas() method is not meant to be used if you are using the jCanvas Layer API, because the API handles redrawing for you in many cases, and so if you try to clear the canvas. you layers will eventually be redrawn by jCanvas when it deems necessary.

If you want to hide a layer temporarily, use setLayer() to set the layer’s visible property, then call drawLayers():

$('canvas').setLayer('myLayerName', {
  visible: false // set to true instead to show the layer again
}).drawLayers();

If you want to remove a layer permanently, call removeLayer() followed by drawLayers():

$('canvas').removeLayer('myLayerName').drawLayers();

Why aren’t my jCanvas handles rotating?

That’s because I haven’t added official support for rotation to my Handles plugin. I have an experimental branch on GitHub where I am testing support for rotation, however please be aware that the implementation is rather buggy. Writing the code for dragging rotated handles is surprisingly tricky; I welcome pull requests from any brave souls who wish to give it a try.

Why aren’t my custom web fonts rendering?

If your web font CSS is embedded on the page via <link>, then the success of your font loading in jCanvas is completely contingent on your font loading before your jCanvas code executes. To ensure this, wrap your relevant jCanvas code in a window load event callback.

$(window).load(function () {
  // Add jCanvas text drawings here
});

Why isn’t setPixels() working on my local machine?

This is probably because you are testing your app from a file:// URL, which most browsers won’t allow; you need to serve your app from a local server instead. See this StackOverflow post for more details.

How do I temporarily show/hide a layer?

To toggle the visibility of a layer, You can use the setLayer() method to set the layer’s visible property to either true or false (depending on whether you want to show or hid it):

// Hide layer temporarily
$('#mycanvas').setLayer('myLayerName', {
  visible: false
});
// Show layer again
$('#mycanvas').setLayer('myLayerName', {
  visible: true
});

Bug Reports

If you are experiencing an issue with jCanvas, please ensure that you are using the latest version of jCanvas before contacting me.

If you are contacting me to report a jCanvas bug, please include the following information:

Remember, the more you tell me, the more I can help. ;)

Documentation or website updates

The entire jCanvas website (including all documentation) is publicly available on GitHub. If you find an issue or want to suggest additional documentation, please create an issue or submit a pull request.

Contact Me

If you have any questions regarding jCanvas or have a bug report to submit, please first check the Documentation or the FAQ above; your question may be already answered there! If you still can’t find an answer, you can contact me in several ways

If you choose to submit an issue on GitHub, please don’t submit a follow-up email notifying me that you submitted an issue. I receive immediate notification for all new emails and GitHub issues, so rest assured I will see your post.

Plugins

If you wish to extend jCanvas with your own methods, you can learn to do so using the Plugin API.

If you would like to submit your jCanvas plugin to the public gallery, follow the procedure for submitting a plugin.

If you would like to submit your jCanvas project to the public gallery, please contact me (see above) with the following information: