redraw canvas after link/button is clicked

1,309 views
Skip to first unread message

Philipp

unread,
Jul 18, 2012, 3:25:28 PM7/18/12
to pap...@googlegroups.com
Hi. I'm doing the following (jquery):

$('.viewswitch.blue').click(function() {
        tasks[current].attributes.visible = true;
});

where tasks[current].attributes is a Group of Items and .viewswitch.blue is a link in my html containing the canvas.

After I click the link the handler fires but the result only shows up after I clicked the canvas in my browser. Is this some expected behaviour and is there a workaround? I tried something like document.getElementById('canvaselement').click() and $('#canvaselement').click() to fake the click, but didn't work.

Thanks,
Philipp

Adrian Demleitner

unread,
Jul 18, 2012, 4:26:47 PM7/18/12
to pap...@googlegroups.com

Try:

paper.view.draw() after

Philipp

unread,
Jul 18, 2012, 4:30:22 PM7/18/12
to pap...@googlegroups.com
So simple. Thanks.

Jeremy Smith

unread,
Aug 27, 2012, 8:32:19 AM8/27/12
to pap...@googlegroups.com
Just FYI, there are basically no examples in the tutorials of reselecting an item, changing a property, and then redrawing it.  So it took some hunting down to find this paper.view.draw() command.  It might be a good idea to highlight this since it is such a common thing to need to do.

Love paper.js, the documentation, and the work you guys are doing!
Reply all
Reply to author
Forward
0 new messages