// 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;
}