On Wednesday, August 1, 2012 at 12:35 , fla...@googlegroups.com wrote:
Group: http://groups.google.com/group/flapjax/topics
- Forcing an event stream to finish [2 Updates]
Bennit <ben....@gmail.com> Jul 31 06:36AM -0700
In the example below I draw a line on a canvas element, however, after the
line is drawn, the event stream for mousemove still fires events. Is there
a way to force event streams to stop receiving events?
Kind regards
Ben
----
// mode -- Line
function modeLine(startX,startY) {
function drawLine(x1,y1,x2,y2) {
context.beginPath();
context.moveTo(x1,y1);
context.lineTo(x2,y2);
context.stroke();
context.closePath();
}
var lineE = receiverE(); // once a line event will be fired
var started = true; // the drawing of this line operation has
started
var pointA = new Point(startX,startY); // the starting point
var pointB = pointA; // the current ending point
jQCanvas.fj('extEvtE','mousemove').mapE(function(mm){
if(started) {
redraw();
drawLine(startX,startY,mm.layerX,mm.layerY);
}
else { console.log('mouse move event after stop');}
});
jQCanvas.fj('extEvtE','mouseup').onceE().mapE(function(mu){
started = false;
lineE.sendEvent(new Line(mu.layerX,mu.layerY));
});
return lineE;
}
Jay Shepherd <zys...@gmail.com> Aug 01 10:08AM +1200
Hi Ben. Checkout filterE, ill give you a better example when im on a pc
:-)
You received this message because you are subscribed to the Google Group flapjax.
--
You can post via email.
To unsubscribe from this group, send an empty message.
For more options, visit this group.
Flapjax home page: www.flapjax-lang.org
Flapjax list: groups.google.com/group/flapjax
Post: fla...@googlegroups.com
Unsubscribe: flapjax-u...@googlegroups.com