author | Dan Fuhry <dan@enanocms.org> |
Sat, 21 Aug 2010 23:35:20 -0400 | |
changeset 43 | 7df4993be0b0 |
parent 42 | 7c6e2e97aa08 |
permissions | -rw-r--r-- |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
1 |
var canvas_mousemove_temp; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
2 |
var canvas_keyup_temp; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
3 |
var CANVAS_KEY_ESC = 27; |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
4 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
5 |
function canvas_click(obj) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
6 |
{ |
42
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
7 |
var click_x = mouseX - $dynano(obj).Left(); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
8 |
var click_y = mouseY - $dynano(obj).Top() + getScrollOffset(); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
9 |
|
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
10 |
if ( obj.canvas_in_draw ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
11 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
12 |
canvas_close_draw(obj, click_x, click_y); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
13 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
14 |
else |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
15 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
16 |
canvas_open_draw(obj, click_x, click_y); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
17 |
} |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
18 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
19 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
20 |
function canvas_open_draw(obj, x, y) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
21 |
{ |
42
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
22 |
obj.canvas_box_obj = canvas_create_box(obj, x, y, 1, 1); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
23 |
obj.canvas_in_draw = true; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
24 |
obj.onclick = function(e) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
25 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
26 |
canvas_click(this); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
27 |
var onclose = this.getAttribute('canvas:oncomplete'); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
28 |
if ( onclose ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
29 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
30 |
eval(onclose); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
31 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
32 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
33 |
canvas_replace_mousemove(obj); |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
34 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
35 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
36 |
function canvas_replace_mousemove(obj) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
37 |
{ |
42
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
38 |
canvas_mousemove_temp = document.onmousemove; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
39 |
canvas_mousemove_temp.box_obj = obj; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
40 |
canvas_keyup_temp = document.onkeyup; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
41 |
document.onmousemove = function(e) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
42 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
43 |
canvas_mousemove_temp(e); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
44 |
canvas_redraw_box(canvas_mousemove_temp.box_obj); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
45 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
46 |
document.onkeyup = function(e) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
47 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
48 |
if ( typeof(canvas_keyup_temp) == 'function' ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
49 |
canvas_keyup_temp(e); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
50 |
|
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
51 |
if ( e.keyCode == CANVAS_KEY_ESC ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
52 |
canvas_cancel_draw(canvas_mousemove_temp.box_obj); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
53 |
} |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
54 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
55 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
56 |
function canvas_restore_mousemove() |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
57 |
{ |
42
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
58 |
document.onmousemove = canvas_mousemove_temp; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
59 |
document.onkeyup = canvas_keyup_temp; |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
60 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
61 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
62 |
function canvas_create_box(obj, x, y, width, height) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
63 |
{ |
42
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
64 |
var inner_width = width - 2; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
65 |
var inner_height = height - 2; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
66 |
var top = $dynano(obj).Top() + y; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
67 |
var left = $dynano(obj).Left() + x; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
68 |
|
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
69 |
// draw outer box |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
70 |
var div_outer = document.createElement('div'); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
71 |
div_outer.className = 'canvasbox'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
72 |
div_outer.style.border = '1px solid #000000'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
73 |
div_outer.style.position = 'absolute'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
74 |
div_outer.style.width = String(width) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
75 |
div_outer.style.height = String(height) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
76 |
div_outer.style.top = String(top) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
77 |
div_outer.style.left = String(left) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
78 |
|
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
79 |
div_outer.rootY = y; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
80 |
div_outer.rootX = x; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
81 |
|
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
82 |
var div_inner = document.createElement('div'); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
83 |
div_inner.style.border = '1px solid #FFFFFF'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
84 |
if ( IE ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
85 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
86 |
div_inner.style.width = '100%'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
87 |
div_inner.style.height = '100%'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
88 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
89 |
else |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
90 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
91 |
div_inner.style.width = String(inner_width) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
92 |
div_inner.style.height = String(inner_height) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
93 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
94 |
|
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
95 |
div_outer.appendChild(div_inner); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
96 |
|
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
97 |
obj.appendChild(div_outer); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
98 |
return div_outer; |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
99 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
100 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
101 |
function canvas_redraw_box(obj) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
102 |
{ |
42
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
103 |
if ( !obj.canvas_box_obj ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
104 |
return false; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
105 |
var rel_x = mouseX - $dynano(obj).Left(); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
106 |
var rel_y = mouseY - $dynano(obj).Top() + getScrollOffset(); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
107 |
var new_width = rel_x - obj.canvas_box_obj.rootX; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
108 |
var new_height = rel_y - obj.canvas_box_obj.rootY; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
109 |
var rootX = obj.canvas_box_obj.rootX; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
110 |
var rootY = obj.canvas_box_obj.rootY; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
111 |
// Limit dimensions to width - origin_x and height - origin_y |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
112 |
if ( new_width + rootX > $dynano(obj).Width() ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
113 |
new_width = $dynano(obj).Width() - rootX; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
114 |
if ( new_height + rootY > $dynano(obj).Height() ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
115 |
new_height = $dynano(obj).Height() - rootY; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
116 |
// If going to the top or left of the origin, avoid negative width/height by moving the box |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
117 |
if ( new_width < 1 ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
118 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
119 |
new_width = rootX - rel_x; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
120 |
obj.canvas_box_obj.style.left = String(mouseX + 2) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
121 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
122 |
if ( new_height < 1 ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
123 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
124 |
new_height = rootY - rel_y; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
125 |
obj.canvas_box_obj.style.top = String(mouseY + getScrollOffset() + 2) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
126 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
127 |
obj.canvas_box_obj.style.width = String(new_width) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
128 |
obj.canvas_box_obj.style.height = String(new_height) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
129 |
new_width = new_width - 2; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
130 |
new_height = new_height - 2; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
131 |
if ( IE ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
132 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
133 |
var nw = new_width; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
134 |
var nh = new_height; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
135 |
obj.canvas_box_obj.firstChild.style.width = String(nw) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
136 |
obj.canvas_box_obj.firstChild.style.height = String(nh) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
137 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
138 |
else |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
139 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
140 |
obj.canvas_box_obj.firstChild.style.width = String(new_width) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
141 |
obj.canvas_box_obj.firstChild.style.height = String(new_height) + 'px'; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
142 |
} |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
143 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
144 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
145 |
function canvas_close_draw(obj, x, y) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
146 |
{ |
42
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
147 |
canvas_restore_mousemove(); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
148 |
obj.canvas_in_draw = false; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
149 |
obj.canvas = { |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
150 |
top: $dynano(obj.canvas_box_obj).Top() - $dynano(obj).Top(), |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
151 |
left: $dynano(obj.canvas_box_obj).Left() - $dynano(obj).Left(), |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
152 |
width: $dynano(obj.canvas_box_obj).Width(), |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
153 |
height: $dynano(obj.canvas_box_obj).Height() |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
154 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
155 |
obj.onclick = function(e) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
156 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
157 |
canvas_click(this); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
158 |
} |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
159 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
160 |
|
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
161 |
function canvas_cancel_draw(obj) |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
162 |
{ |
42
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
163 |
canvas_restore_mousemove(); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
164 |
obj.canvas_in_draw = false; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
165 |
obj.removeChild(obj.canvas_box_obj); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
166 |
obj.canvas_box_obj = null; |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
167 |
obj.onclick = function(e) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
168 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
169 |
canvas_click(this); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
170 |
} |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
171 |
var ga = obj.getAttribute('canvas:oncancel'); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
172 |
if ( ga ) |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
173 |
{ |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
174 |
eval(ga); |
7c6e2e97aa08
Added AJAX file upload support.
Dan Fuhry <dan@enanocms.org>
parents:
35
diff
changeset
|
175 |
} |
18
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
176 |
} |
c1c398349651
Added initial support for notes (aka tags) on images, done completely (including initial load of metadata) with AJAX. They're not fixed at 100x100 like on Facebook either.
Dan
parents:
diff
changeset
|
177 |