|
|
@ -12,10 +12,17 @@ var drawing = { |
|
|
|
}; |
|
|
|
|
|
|
|
function down(e){ |
|
|
|
line.starting_point.x = e.pageX - this.offsetLeft; |
|
|
|
line.starting_point.y = e.pageY - this.offsetTop; |
|
|
|
line.end_point.x = e.pageX - this.offsetLeft; |
|
|
|
line.end_point.y = e.pageY - this.offsetTop; |
|
|
|
var x = e.pageX, y = e.pageY; |
|
|
|
var obj = e.target; |
|
|
|
do { |
|
|
|
x -= obj.offsetLeft; |
|
|
|
y -= obj.offsetTop; |
|
|
|
} while(obj = obj.offsetParent); |
|
|
|
|
|
|
|
line.starting_point.x = x; |
|
|
|
line.starting_point.y = y; |
|
|
|
line.end_point.x = x; |
|
|
|
line.end_point.y = y; |
|
|
|
drawing.active = true; |
|
|
|
|
|
|
|
drawing.draw_start(line); |
|
|
@ -29,8 +36,15 @@ function up(e){ |
|
|
|
|
|
|
|
function move(e){ |
|
|
|
if(drawing.active){ |
|
|
|
line.end_point.x = e.pageX - this.offsetLeft; |
|
|
|
line.end_point.y = e.pageY - this.offsetTop; |
|
|
|
var x = e.pageX, y = e.pageY; |
|
|
|
var obj = e.target; |
|
|
|
do { |
|
|
|
x -= obj.offsetLeft; |
|
|
|
y -= obj.offsetTop; |
|
|
|
} while(obj = obj.offsetParent); |
|
|
|
|
|
|
|
line.end_point.x = x; |
|
|
|
line.end_point.y = y; |
|
|
|
|
|
|
|
drawing.draw_move(line); |
|
|
|
} |
|
|
|