Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #22102 > unrolled thread
| Started by | Ed Jay <edMbj@aes-intl.com> |
|---|---|
| First post | 2013-11-21 11:48 -0800 |
| Last post | 2013-11-22 12:35 -0500 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.javascript
Why is this misbehaving? Ed Jay <edMbj@aes-intl.com> - 2013-11-21 11:48 -0800
Re: Why is this misbehaving? Ed Jay <edMbj@aes-intl.com> - 2013-11-21 18:45 -0800
Re: Why is this misbehaving? Norman Peelman <npeelman@cfl.rr.com> - 2013-11-22 12:35 -0500
| From | Ed Jay <edMbj@aes-intl.com> |
|---|---|
| Date | 2013-11-21 11:48 -0800 |
| Subject | Why is this misbehaving? |
| Message-ID | <jpns8991k860s2qpcs9jgrk0hf2faiir6m@4ax.com> |
Post refers to using canvas.
Below is prototype code to save, then mark, and ultimately restore
portions of a canvas. A left click marks the canvas and creates a div to
sit atop the marker. A right click restores the marker area to the
original.
I'm stopped with puzzlement over why if I set i = integer, the following
code works fine, but if I set i = the variable 'marker' + marker_cnt (
an integer value), on right clicking, an error is thrown with the message
"Uncaught exception: DOMException: TYPE_MISMATCH_ERR."
I've made marker_cnt a number and a string -- both result in error.
>>>>>
x_pos_array.length = y_pos_array.length = marker_cnt = 0;
//Routine creates marker canvas and draw/copy canvas area to marker canvas
i = 1; //marker_cnt; (Changing i from any nr to variable causes problem)
x_pos = event.x;
y_pos = event.y;
x_pos -= canvas.offsetLeft;
y_pos -= canvas.offsetTop;
x_posx = x_pos + canvas.offsetLeft;
y_posy = y_pos +canvas.offsetTop;
if (event.which == 1) {
var div = document.createElement('div');
document.body.appendChild(div);
div.id = 'mrkr'+marker_cnt;
div.style.width = 1*mrkr_w +'px';
div.style.height = 1*mrkr_h +'px';
div.style.position = 'absolute'
div.style.top = y_posy-mrkr_h/2+'px';
div.style.left = x_posx-mrkr_w/2+'px';
div.innerHTML = " ";
div.addEventListener("mouseover",function(){
this.style.backgroundColor="rgba(255,255,0,.4)";over_marker(this.id);}
);
///////////////Routine to create marker canvas and draw/copy canvas area
to marker canvas
var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.id = "CursorLayer"+i;
canvas.width = mrkr_w;
canvas.height = mrkr_h;
canvas.style.display = 'none';
xx = document.getElementById("CursorLayer"+i);
xxx = xx.getContext('2d');
xxx.drawImage(sti_image_id, x_pos, y_pos, mrkr_w, mrkr_h, 0, 0, mrkr_w,
mrkr_h);
///////////////////Routine to creat rectangle and temperature text marker
on image
mark_temp = t_at_mouse.toFixed(1); //marker_cnt;
final_image.fillStyle = 'rgba(255,255,0,1)';
final_image.font = "8pt Arial";
final_image.fillText(mark_temp, x_pos, y_pos+10);
x_pos_array.push(x_pos);
y_pos_array.push(y_pos)
marker_cnt++;
}//end of event.which = 1
//********************************************************** Error occurs
after this
if (event.which == 3) {i = marker_cnt;alert("cnt = "+typeof i);
placer = ;
xx = document.getElementById("CursorLayer"+i);
final_image.drawImage(xx, 0, 0, mrkr_w, mrkr_h, x_pos, y_pos, mrkr_w,
mrkr_h);
}
output_result();
}
}
Help, please...what am I missing?
--
Ed Jay (remove 'M' to reply by email)
Win the War Against Breast Cancer.
Knowing the facts could save your life.
http://www.breastthermography.info
[toc] | [next] | [standalone]
| From | Ed Jay <edMbj@aes-intl.com> |
|---|---|
| Date | 2013-11-21 18:45 -0800 |
| Message-ID | <m8ht899o57bit5hffvmnnrk4jsfkq39mnk@4ax.com> |
| In reply to | #22102 |
Ed Jay wrote: >Post refers to using canvas. >Help, please...what am I missing? Solved. Thanks, anyway. -- Ed Jay (remove 'M' to respond by email)
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2013-11-22 12:35 -0500 |
| Message-ID | <l6o4kn$tr$1@dont-email.me> |
| In reply to | #22116 |
On 11/21/2013 09:45 PM, Ed Jay wrote: > Ed Jay wrote: > >> Post refers to using canvas. >> Help, please...what am I missing? > > Solved. > > Thanks, anyway. > What was the solve? -- Norman Registered Linux user #461062 AMD64X2 6400+ Ubuntu 10.04 64bit
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web