|
@@ -0,0 +1,231 @@
|
|
1
|
+function paint_canvas(){
|
|
2
|
+ var c = document.getElementById("back-canvas");
|
|
3
|
+ var ctx = c.getContext("2d");
|
|
4
|
+ var img = document.getElementById("oller");
|
|
5
|
+ ctx.drawImage(img, 0, 0);
|
|
6
|
+ var imgData = ctx.getImageData(0, 0, c.width, c.height);
|
|
7
|
+ ctx.putImageData(imgData, 0, 0);
|
|
8
|
+}
|
|
9
|
+
|
|
10
|
+$(document).ready(function() {
|
|
11
|
+ $("#pointer_div").on("mousemove", function(event) {
|
|
12
|
+ var x = event.pageX - this.offsetLeft;
|
|
13
|
+ var y = event.pageY - this.offsetTop;
|
|
14
|
+ draw_circle(x,y);
|
|
15
|
+ });
|
|
16
|
+});
|
|
17
|
+
|
|
18
|
+function draw_circle(x,y){
|
|
19
|
+ var c = document.getElementById("back-canvas");
|
|
20
|
+ var ctx = c.getContext("2d");
|
|
21
|
+ var img = document.getElementById("oller");
|
|
22
|
+ ctx.drawImage(img, 0, 0);
|
|
23
|
+ var width = x;//x
|
|
24
|
+ var height = y;//y center of circle
|
|
25
|
+ var radius = 100;// radius of circle
|
|
26
|
+ var x1,y1;
|
|
27
|
+ var x_bitmap = [];
|
|
28
|
+ var y_bitmap = [];
|
|
29
|
+
|
|
30
|
+ for(x1 = 0; x1 < radius; x1 += 1){
|
|
31
|
+ for(y1 = 0; y1 < radius; y1 += 1){
|
|
32
|
+ if(((x1-(radius/2))**2 + (y1-(radius/2))**2) < (radius/2)**2){
|
|
33
|
+ x_bitmap.push(x1);//every x coordinate for circle
|
|
34
|
+ y_bitmap.push(y1);// every y coordinate for circle
|
|
35
|
+ // I need to convert this bitmap into the circle...
|
|
36
|
+ }
|
|
37
|
+ }
|
|
38
|
+ }
|
|
39
|
+ var imgData = ctx.getImageData(x-(radius*4.25), y-(radius), radius, radius);
|
|
40
|
+ var x2,y2,index;
|
|
41
|
+ var a = [];
|
|
42
|
+ for(x2 = 0; x2 < x_bitmap.length; x2 += 1){
|
|
43
|
+ index = (4 * x_bitmap[x2]) + (y_bitmap[x2] * 4 * radius);
|
|
44
|
+ imgData.data[3 + index] = 0;
|
|
45
|
+
|
|
46
|
+ }
|
|
47
|
+ ctx.putImageData(imgData, x-(radius*4.25), y-(radius));
|
|
48
|
+}
|
|
49
|
+
|
|
50
|
+function clear_radios(){
|
|
51
|
+ var fradio = document.getElementsByName('front-radio');
|
|
52
|
+ var bradio = document.getElementsByName('back-radio');
|
|
53
|
+ var length = fradio.length;
|
|
54
|
+ for(var index = 0; index < length; index ++){
|
|
55
|
+ if(fradio[index].checked){
|
|
56
|
+ fradio[index].checked = false;
|
|
57
|
+ bradio[index].disabled = false;
|
|
58
|
+ }
|
|
59
|
+ else if(bradio[index].checked){
|
|
60
|
+ bradio[index].checked = false;
|
|
61
|
+ fradio[index].disabled = false;
|
|
62
|
+
|
|
63
|
+ }
|
|
64
|
+ }
|
|
65
|
+}
|
|
66
|
+
|
|
67
|
+function front(){
|
|
68
|
+ var radios = document.getElementsByName('front-radio');
|
|
69
|
+ var length = radios.length;
|
|
70
|
+ for(var index = 0; index < length; index ++){
|
|
71
|
+ if(radios[index].checked){
|
|
72
|
+ switch(radios[index].value){
|
|
73
|
+ case "visual":
|
|
74
|
+ document.getElementById("oller").src = "images/paisaje-frances.png";
|
|
75
|
+ var radio = document.getElementsByName('back-radio');
|
|
76
|
+ var disabled;
|
|
77
|
+ for(disabled = 0; disabled < length; disabled ++){
|
|
78
|
+ if(disabled == index){
|
|
79
|
+ radio[disabled].checked = false;
|
|
80
|
+ radio[disabled].disabled = true;
|
|
81
|
+ }
|
|
82
|
+ else{
|
|
83
|
+ if(radio[disabled].value == "ultraviolet" ||
|
|
84
|
+ radio[disabled].value == "x-ray"){
|
|
85
|
+ radio[disabled].disabled = true;
|
|
86
|
+ }
|
|
87
|
+ else{
|
|
88
|
+ radio[disabled].disabled = false;
|
|
89
|
+ }
|
|
90
|
+ }
|
|
91
|
+ }
|
|
92
|
+ break;
|
|
93
|
+ case "infrared":
|
|
94
|
+ document.getElementById("oller").src = "images/paisaje-frances-infrared.png";
|
|
95
|
+ var radio = document.getElementsByName('back-radio');
|
|
96
|
+ var disabled;
|
|
97
|
+ for(disabled = 0; disabled < length; disabled ++){
|
|
98
|
+ if(disabled == index){
|
|
99
|
+ radio[disabled].checked = false;
|
|
100
|
+ radio[disabled].disabled = true;
|
|
101
|
+ }
|
|
102
|
+ else{
|
|
103
|
+ if(radio[disabled].value == "ultraviolet" ||
|
|
104
|
+ radio[disabled].value == "x-ray"){
|
|
105
|
+ radio[disabled].disabled = true;
|
|
106
|
+ }
|
|
107
|
+ else{
|
|
108
|
+ radio[disabled].disabled = false;
|
|
109
|
+ }
|
|
110
|
+ }
|
|
111
|
+ }
|
|
112
|
+ break;
|
|
113
|
+ case "ultraviolet":
|
|
114
|
+ document.getElementById("oller").src = "images/paisaje-frances.png";
|
|
115
|
+ var radio = document.getElementsByName('back-radio');
|
|
116
|
+ var disabled;
|
|
117
|
+ for(disabled = 0; disabled < length; disabled ++){
|
|
118
|
+ if(disabled == index){
|
|
119
|
+ radio[disabled].disabled = true;
|
|
120
|
+ }
|
|
121
|
+ else{
|
|
122
|
+ radio[disabled].disabled = false;
|
|
123
|
+ }
|
|
124
|
+ }
|
|
125
|
+ break;
|
|
126
|
+ case "x-ray":
|
|
127
|
+ document.getElementById("oller").src = "images/paisaje-frances.png";
|
|
128
|
+ var radio = document.getElementsByName('back-radio');
|
|
129
|
+ var disabled;
|
|
130
|
+ for(disabled = 0; disabled < length; disabled ++){
|
|
131
|
+ if(disabled == index){
|
|
132
|
+ radio[disabled].disabled = true;
|
|
133
|
+ }
|
|
134
|
+ else{
|
|
135
|
+ radio[disabled].disabled = false;
|
|
136
|
+ }
|
|
137
|
+ }
|
|
138
|
+ break;
|
|
139
|
+ default:
|
|
140
|
+ }
|
|
141
|
+ break;
|
|
142
|
+ }
|
|
143
|
+ }
|
|
144
|
+}
|
|
145
|
+
|
|
146
|
+function back(){
|
|
147
|
+ var radios = document.getElementsByName('back-radio');
|
|
148
|
+ var length = radios.length;
|
|
149
|
+ for(var index = 0; index < length; index ++){
|
|
150
|
+ if(radios[index].checked){
|
|
151
|
+ switch(radios[index].value) {
|
|
152
|
+ case "visual":
|
|
153
|
+ document.getElementById("back-canvas").style.backgroundImage = "url('images/paisaje-frances.png')";
|
|
154
|
+ var radio = document.getElementsByName('front-radio');
|
|
155
|
+ var disabled;
|
|
156
|
+ for(disabled = 0; disabled < length; disabled ++){
|
|
157
|
+ if(disabled == index){
|
|
158
|
+ radio[disabled].checked = false;
|
|
159
|
+ radio[disabled].disabled = true;
|
|
160
|
+ }
|
|
161
|
+ else{
|
|
162
|
+ if(radio[disabled].value == "ultraviolet" ||
|
|
163
|
+ radio[disabled].value == "x-ray"){
|
|
164
|
+ radio[disabled].disabled = true;
|
|
165
|
+ }
|
|
166
|
+ else{
|
|
167
|
+ radio[disabled].disabled = false;
|
|
168
|
+ }
|
|
169
|
+ }
|
|
170
|
+ }
|
|
171
|
+ break;
|
|
172
|
+ case "infrared":
|
|
173
|
+ document.getElementById("back-canvas").style.backgroundImage = "url('images/paisaje-frances-infrared.png')";
|
|
174
|
+ var radio = document.getElementsByName('front-radio');
|
|
175
|
+ var disabled;
|
|
176
|
+ for(disabled = 0; disabled < length; disabled ++){
|
|
177
|
+ if(disabled == index){
|
|
178
|
+ radio[disabled].checked = false;
|
|
179
|
+ radio[disabled].disabled = true;
|
|
180
|
+ }
|
|
181
|
+ else{
|
|
182
|
+ if(radio[disabled].value == "ultraviolet" ||
|
|
183
|
+ radio[disabled].value == "x-ray"){
|
|
184
|
+ radio[disabled].disabled = true;
|
|
185
|
+ }
|
|
186
|
+ else{
|
|
187
|
+ radio[disabled].disabled = false;
|
|
188
|
+ }
|
|
189
|
+ }
|
|
190
|
+ }
|
|
191
|
+ break;
|
|
192
|
+ case "ultraviolet":
|
|
193
|
+ document.getElementById("back-canvas").style.backgroundImage = "url('images/paisaje-frances.png')";
|
|
194
|
+ var radio = document.getElementsByName('front-radio');
|
|
195
|
+ var disabled;
|
|
196
|
+ for(disabled = 0; disabled < length; disabled ++){
|
|
197
|
+ if(disabled == index){
|
|
198
|
+ radio[disabled].disabled = true;
|
|
199
|
+ }
|
|
200
|
+ else{
|
|
201
|
+ radio[disabled].disabled = false;
|
|
202
|
+ }
|
|
203
|
+ }
|
|
204
|
+ break;
|
|
205
|
+ case "x-ray":
|
|
206
|
+ document.getElementById("back-canvas").style.backgroundImage = "url('images/paisaje-frances.png')";
|
|
207
|
+ var radio = document.getElementsByName('front-radio');
|
|
208
|
+ var disabled;
|
|
209
|
+ for(disabled = 0; disabled < length; disabled ++){
|
|
210
|
+ if(disabled == index){
|
|
211
|
+ radio[disabled].disabled = true;
|
|
212
|
+ }
|
|
213
|
+ else{
|
|
214
|
+ radio[disabled].disabled = false;
|
|
215
|
+ }
|
|
216
|
+ }
|
|
217
|
+ break;
|
|
218
|
+ default:
|
|
219
|
+ }
|
|
220
|
+ break;
|
|
221
|
+ }
|
|
222
|
+ }
|
|
223
|
+}
|
|
224
|
+
|
|
225
|
+function openNav() {
|
|
226
|
+ document.getElementById("sidebar").style.width = "200px";
|
|
227
|
+}
|
|
228
|
+
|
|
229
|
+function closeNav() {
|
|
230
|
+ document.getElementById("sidebar").style.width = "0";
|
|
231
|
+}
|