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