Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen will Sencha Touch Charts handle events on DrawComponent Sprites?
    primarykey
    data
    text
    <p>In the Sencha Touch Charts 2 beta distribution, the Drawing guide example code has an example of a Sprite listening for touch start. The code given fails to draw any sprites, because it fails to insert a canvas onto the DOM. However this can be fixed by replacing this:</p> <pre><code> //add the component to the panel Ext.create('Ext.chart.Panel', { fullscreen: true, title: 'Yellow Circle', items: drawComponent }); </code></pre> <p>with this:</p> <pre><code> //add the component to the panel Ext.create('Ext.chart.Panel', { fullscreen: true, title: 'Yellow Circle', chart: drawComponent }); </code></pre> <p>Now, I'd really like to get the event handling to work. The example code continues with:</p> <pre><code>// Add a circle sprite var myCircle = drawComponent.surface.add({ type: 'circle', x: 100, y: 100, radius: 100, fill: '#cc5' }); // Now do stuff with the sprite, like changing its properties: myCircle.setAttributes({ fill: '#ccc' }, true); // Remember always to refresh the image drawComponent.surface.renderFrame(); // or animate an attribute on the sprite // no need to refresh the image when adding animations. myCircle.fx.start({ fill: '#555' }); // Add a touch listener to the sprite myCircle.addListener('touchstart', function() { alert('touchstarted!'); }); </code></pre> <p>but that final alert never happens on touch. Any ideas?</p> <p>drawComponent.addListener('touchstart'... works fine, but is of course not localised to the circle sprite.</p> <p>--- after more investigation ---</p> <p>I think the answer is simply that event handling on sprites his not implemented yet. e.g. in touch-charts/src/draw/engine/Canvas.js we have in the definition of Ext.draw.engine.Canvas, </p> <pre><code>getSpriteForEvent: function(e) { return null; //TODO!!! }, </code></pre> <p>OK - time to change the question from 'how?' to 'when?':</p> <blockquote> <p><strong>'When will Sencha Touch support Sprite event handling?"</strong></p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload