Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#15877 closed defect (fixed)

[regression] 'new Moveable(shape)' not working with canvas renderer

Reported by: k255 Owned by: Colin Snover
Priority: blocker Milestone: 1.8.1
Component: DojoX GFX Version: 1.8.0
Keywords: Cc: Colin Snover
Blocked By: Blocking:

Description

Recently I've experienced troubles with gfx Moveable using gfxRenderer:'canvas' with dojo 1.8.0 - it's not working (works fine in 1.7.0). It fails with unhandled exception:

uncaught exception: dojox.gfx.shape.fixCallback: scope["_function (node, listener) { return on(node, type, listener); }"] is null (scope="[object Object]")

Code example:

<!--moveable on canvas not working -->
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.js"
    data-dojo-config="gfxRenderer:'canvas', async: true"></script>


<!-- moveable on svg works fine
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.js"
    data-dojo-config="gfxRenderer:'svg', async: true"></script>
-->

<!--moveable on canvas works in version 1.7.0
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.js"
    data-dojo-config="gfxRenderer:'canvas', async: true"></script>
-->

<script type="text/javascript">
var surface;

// Require stuff
require(["dojox/gfx","dojox/gfx/Moveable","dojo/domReady!"]
, function(gfx, Moveable) {

surface = dojox.gfx.createSurface("surfaceElement",400,400);
    
// Add a circle
var circle = surface.createCircle({ cx: 100, cy: 150, r:50 })
    .setFill("green")
    .setStroke("pink");

// Just checking if ui is responsive
circle.connect("onclick", function(e) {
    circle.setFill("red");
});    

// As in http://dojotoolkit.org/documentation/tutorials/1.8/gfx/
new Moveable(circle);
});
</script>

<div id="surfaceElement"></div>

Also JSFidlle is available: http://jsfiddle.net/RQvVU/2/

Change History (8)

comment:1 Changed 7 years ago by k255

comment:2 Changed 7 years ago by k255

This bug was introduced with this changeset:

http://bugs.dojotoolkit.org/changeset/29382/dojo

Substitution of 'onmousedown' with 'touch.press' at line 33 of Moveable.js caused the exception.

comment:3 Changed 7 years ago by bill

Milestone: tbd1.8.1
Owner: changed from Eugene Lazutkin to Colin Snover
Status: newassigned

That's Colin's changeset (although it's possible there's an issue with dojo/touch itself). Sounds like a regression so marking this for 1.8.1.

comment:4 Changed 7 years ago by Colin Snover

Cc: Colin Snover added
Priority: undecidedblocker
Summary: 'new Moveable(shape)' not working with canvas renderer[regression] 'new Moveable(shape)' not working with canvas renderer

canvas renderer requires a string for the event type, but dojo/touch properties are extension event functions. Not sure why dojo/touch is using functions when it could just use strings and work the same. I would say this is a deficiency of the canvas renderer event handling though, it should support extension events like anything else.

comment:5 in reply to:  4 Changed 7 years ago by Patrick Ruzand

Replying to csnover:

canvas renderer requires a string for the event type, but dojo/touch properties are extension event functions. [...]I would say this is a deficiency of the canvas renderer event handling though, it should support extension events like anything else.

This is indeed a limitation of the canvas renderer that does not support dojo/touch today. This is the reason why dojo/touch was not used in the #12363 initial patch I committed. Moreover, the gfx implementations have not been fully tested against dojo/touch, so it may impact other renderers as well. Supporting dojo/touch was planned for 1.8 initially but could not make it in the planning. And since it may require deep modifications, I don't think it's a good candidate for a minor release. IMO, the http://bugs.dojotoolkit.org/changeset/29382/dojo changeset should be reverted and/or fixed without using dojo/touch.

comment:6 Changed 7 years ago by Colin Snover

Resolution: fixed
Status: assignedclosed

In [29651]:

Update dojox/gfx/Mover and dojox/gfx/Moveable to use string event names since the canvas renderer cannot handle extension events. Fixes #15877.

comment:7 Changed 7 years ago by Colin Snover

In [29652]:

Fix dojox/gfx/Moveable.onMouseUp removing too many events when delay > 0 and normalize event names within dojox/gfx/canvasWithEvents so that people can provide consistent event names without things exploding. Refs #15877.

comment:8 Changed 7 years ago by Colin Snover

In [29653]:

Backport to 1.8. Refs #15877.

Note: See TracTickets for help on using tickets.