{"id":21038,"date":"2016-04-04T03:01:00","date_gmt":"2016-04-03T17:01:00","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=21038"},"modified":"2016-04-03T21:23:15","modified_gmt":"2016-04-03T11:23:15","slug":"canvas-annotation-email-attachment-undo-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/canvas-annotation-email-attachment-undo-tutorial\/","title":{"rendered":"Canvas Annotation Email Attachment Undo Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Canvas Annotation Email Attachment Undo Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/worldundo.jpg\" title=\"Canvas Annotation Email Attachment Undo Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Canvas Annotation Email Attachment Undo Tutorial<\/p><\/div>\n<p>A web application allowing user defined Annotations is better when there is an &#8220;Undo&#8221; and &#8220;Redo&#8221; functionality option.  This is because with any user intervention, there can be erroneous work, which sometimes can be a real pain to recover from scratch.<\/p>\n<p>With &#8220;Undo&#8221; and &#8220;Redo&#8221; functionality, however, you do not want the user to think it is as much a part of the &#8220;mainstream&#8221; of the web application&#8217;s functionality, so we supply a &#8220;-&#8221; (minus) button for &#8220;Undo&#8221; and a &#8220;+&#8221; (plus) button for &#8220;Redo&#8221;, and make them smaller than other Annotation functionality buttons.<\/p>\n<p>So how do we achieve this functionality?  We actually do it by actually &#8230;<\/p>\n<ol>\n<li>always clearing the contents of the HTML canvas element<\/li>\n<li>always place the original image via canvas.<a target=_blank title='HTML canvas element drawImage() method information from w3schools' href='http:\/\/www.w3schools.com\/tags\/canvas_drawimage.asp'>drawImage<\/a>() method<\/li>\n<li>calling on a stored Javascript array containing HTML canvas drawing statements, flagging the ones that represent a single user defined action, that one &#8220;single user defined action&#8221; being what an &#8220;Undo&#8221; or &#8220;Redo&#8221; action works regarding<\/li>\n<\/ol>\n<p>There is a great resource for information about the Javascript &#8220;Array&#8221; object called <a target=_blank title='ECMAScript\u00ae Language Specification' href='http:\/\/www.ecma-international.org\/ecma-262\/5.1\/'>ECMAScript\u00ae Language Specification<\/a> (we got to via <a target=_blank title='Useful link' href='http:\/\/stackoverflow.com\/questions\/1748794\/is-there-an-arraylist-in-javascript'>this link<\/a>, which is also excellent as an &#8220;Array&#8221; object member functionality synopsis (and which we urge you to consult), thanks).<\/p>\n<p>You may wonder about how canvas.drawImage() parameter 1 (an image object) is handled.  We assume you will only be interested in &#8220;Undo&#8221;s and &#8220;Redo&#8221;s of the last image (object) involved, which is stored in a global var<font size=1>iable<\/font> (and rereferenced by &#8220;Undo&#8221; and\/or &#8220;Redo&#8221;) when the Annotations are created (and built up) by the user.<\/p>\n<p>So yet again, our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html-----GETME\" title='world.html'>world.html<\/a> (with its <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html\" title='world.html'>live run<\/a>) did not need to change for this new &#8220;Undo&#8221;\/&#8221;Redo&#8221; functionality but our external Javascript you could call <a target=_blank title='world.js' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.js---GETME' title='world.js'>world.js<\/a> changed <a target=_blank title='world.js' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.js----GETME' title='world.js'>quite a bit<\/a>, setting up these Javascript arrays storing HTML canvas commands, for later use in &#8220;Undo&#8221; and &#8220;Redo&#8221; scenarios instigated by users clicking the relevant respective (small) &#8220;-&#8221; and &#8220;+&#8221; buttons.<\/p>\n<p>As for &#8230;<\/p>\n<blockquote><p>\nWe &#8220;might&#8221; have genericized the world.html changes into other HTMLs of its ilk &#8230; well, we decided against that for now &#8230; but will later &#8230; and partly the reason is that there is more to do, and we just want to concentrate on world.html\n<\/p><\/blockquote>\n<p> &#8230; we can now apply changes to the other HTML web applications &#8230;<\/p>\n<ul>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/australia.html---GETME\" title=\"australia.htm\">australia.htm<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/australia.html---GETME\" title=\"australia.htm\">this way<\/a> with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/australia.html\" title=\"australia.htm\">live run<\/a> link<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/brazil.html---GETME\" title=\"brazil.htm\">brazil.htm<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/brazil.html---GETME\" title=\"brazil.htm\">this way<\/a> with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/brazil.html\" title=\"brazil.htm\">live run<\/a> link<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/china.html---GETME\" title=\"china.htm\">china.htm<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/china.html---GETME\" title=\"china.htm\">this way<\/a> with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/china.html\" title=\"china.htm\">live run<\/a> link<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/germany.html---GETME\" title=\"germany.htm\">germany.htm<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/germany.html---GETME\" title=\"germany.htm\">this way<\/a> with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/germany.html\" title=\"germany.htm\">live run<\/a> link<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/india.html---GETME\" title=\"india.htm\">india.htm<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/india.html---GETME\" title=\"india.htm\">this way<\/a> with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/india.html\" title=\"india.htm\">live run<\/a> link<\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ireland.html---GETME\" title=\"ireland.htm\">ireland.htm<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ireland.html---GETME\" title=\"ireland.htm\">this way<\/a> with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ireland.html\" title=\"ireland.htm\">live run<\/a> link<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/nigeria.html---GETME\"  title=\"nigeria.htm\">nigeria.htm<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/nigeria.html---GETME\"  title=\"nigeria.htm\">this way<\/a> with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/nigeria.html\"  title=\"nigeria.htm\">live run<\/a> link<\/a><\/li>\n<li><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/united_states.html---GETME\" title=\"united_states.htm\">united_states.htm<\/a> changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/united_states.html---GETME\" title=\"united_states.htm\">this way<\/a> with a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/united_states.html\" title=\"united_states.htm\">live run<\/a> link<\/li>\n<\/ul>\n<p>Also changing is the email attachment PHP helper you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.php-GETME\" title='world.php'>world.php<\/a> changed in <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.php-GETME\" title='world.php'>this way<\/a>.<\/p>\n<p>Hope this HTML canvas web application set gives you some ideas for work of your own. To read some of the background to this, try <a title='Canvas Email Attachment Scribble Tutorial' href='#ceast'>Canvas Email Attachment Scribble Tutorial<\/a> as shown below.<\/p>\n<hr>\n<p id='ceast'>Previous relevant <a target=_blank title='Canvas Email Attachment Scribble Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/canvas-email-attachment-scribble-tutorial\/'>Canvas Email Attachment Scribble Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Canvas Email Attachment Scribble Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/worldscribble.jpg\" title=\"Canvas Email Attachment Scribble Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Canvas Email Attachment Scribble Tutorial<\/p><\/div>\n<p>Personally think that Annotations are better when there is a &#8220;Scribble&#8221; functionality option.  Perhaps you want to &#8220;sign off&#8221; on your Annotations.  Without a &#8220;Scribble&#8221; option, it&#8217;s a bit impersonal relying on computer fonts as the means by which you &#8220;sign&#8221; the work.<\/p>\n<p>And down the track it&#8217;s helping with our &#8220;final aim&#8221;, which will be revealed as time goes on.<\/p>\n<p>To &#8220;Scribble&#8221; the main mouse event that interests us is the <a target=_blank title='HTML onmousemove event information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/event_onmousemove.asp'>&#8220;onmousemove&#8221; event<\/a> which happens when the mouse &#8230; moves &#8230; in which case if you are in &#8220;Scribble&#8221; mode, draw a line between the last two data points.  So from that you would glean, and we&#8217;ll fill in, as well, that &#8230;<\/p>\n<ul>\n<li>the user needs to tell the computer it wants to start into &#8220;Scribble&#8221; mode (like a green light on the traffic light) &#8230; after a 2 second delay to allow the user to position themselves with their mouse &#8230; so we introduce a button for that, that the user can click &#8230; but how does the user do what was considered in the early days of all graphical application work &#8230; &#8220;pen up&#8221; &#8230; ie. mouse up &#8230; so &#8230;<\/li>\n<li>if onmouseup (or touchend) gets triggered we want it not to draw lines but be ready to resume (like a yellow light on the traffic light) &#8230; and when in this mode &#8230;<\/li>\n<li>if onmousedown gets triggered while &#8220;the traffic light is yellow&#8221; (ie. in the mode above) we want it to start to draw lines again with any mouse moves &#8230; and to call the whole thing off &#8230;<\/li>\n<li>if the keyboard is used stop any &#8220;Scribble&#8221; operations (or click the crossed out button supplied) (like a red light on the traffic light)<\/li>\n<\/ul>\n<p>Reinventing pen<strike>man<\/strike>personship is a bit of a stretch, but nevertheless, adds a degree of authenticity to your content, for this is what you are doing, should you go on and email your work as an email attachment &#8230; you become an uploader of content &#8230; yet again, no doubt.  This is a lot more common on the net for all of us, as each day passes.  Maybe also, as each night passes.  Even as Collingwood streams down the left wing, and passes, no doubt.<\/p>\n<p>Yet again, our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html-----GETME\" title='world.html'>world.html<\/a> did not need to change for this new &#8220;Scribble&#8221; functionality but our external Javascript you could call <a target=_blank title='world.js' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.js--GETME' title='world.js'>world.js<\/a> changed quite a bit, setting up these <b>mouse (or touch) event logics<\/b>, as its Javascript &#8220;setTimeout&#8221; delayed onload function &#8230;<\/p>\n<p><code><br \/>\n<b><br \/>\nfunction touchHandler(event) \/\/ thanks to http:\/\/stackoverflow.com\/questions\/1517924\/javascript-mapping-touch-events-to-mouse-events<br \/>\n{<br \/>\n    var touches = event.changedTouches,<br \/>\n        first = touches[0],<br \/>\n        type = \"\";<br \/>\n    \/\/if (event.targetTouches.length == 1) {<br \/>\n <\/b><b><br \/>\n    switch(event.type)<br \/>\n    {<br \/>\n        \/\/case \"touchstart\": type=\"mousedown\"; break;<br \/>\n        case \"touchmove\":  type=\"mousemove\"; break;<br \/>\n        case \"touchend\":   type=\"mouseup\"; break;<br \/>\n        default: return;<br \/>\n    }<br \/>\n <\/b><b><br \/>\n             \/\/initMouseEvent(type, canBubble, cancelable, view, clickCount,<br \/>\n    \/\/           screenX, screenY, clientX, clientY, ctrlKey,<br \/>\n    \/\/           altKey, shiftKey, metaKey, button, relatedTarget);<br \/>\n <\/b><b><br \/>\n    var simulatedEvent = document.createEvent(\"MouseEvent\");<br \/>\n    simulatedEvent.initMouseEvent(type, true, true, window, 1,<br \/>\n                              first.screenX, first.screenY,<br \/>\n                              first.clientX, first.clientY, false,<br \/>\n                              false, false, false, 0\/*left*\/, null);<br \/>\n <\/b><b><br \/>\n    first.target.dispatchEvent(simulatedEvent);<br \/>\n <\/b><b><br \/>\n    event.preventDefault();<br \/>\n    event.stopPropagation();<br \/>\n <\/b><b><br \/>\n    switch(type)<br \/>\n    {<br \/>\n        \/\/case \"mousedown\": if (isScribble == 1) { isScribble=2; } break;<br \/>\n        case \"mousemove\": if (isScribble == 2) {<br \/>\n       if (x == 0 && y == 0 && lastx == 0 && lasty == 0) {<br \/>\n       if (event.pageX || event.pageY) {<br \/>\n       x = event.pageX - elemLeft;<br \/>\n       y = event.pageY - elemTop;<br \/>\n       } else {<br \/>\n       x = event.clientX - elemLeft;<br \/>\n       y = event.clientY - elemTop;<br \/>\n       }<br \/>\n       lastx=x;<br \/>\n       lasty=y;<br \/>\n       } else {<br \/>\n       lastx=x;<br \/>\n       lasty=y;<br \/>\n       if (event.pageX || event.pageY) {<br \/>\n       x = event.pageX - elemLeft;<br \/>\n       y = event.pageY - elemTop;<br \/>\n       } else {<br \/>\n       x = event.clientX - elemLeft;<br \/>\n       y = event.clientY - elemTop;<br \/>\n       }<br \/>\n       }<br \/>\n     if (x != lastx || y != lasty) {<br \/>\n      document.getElementById('divannotation').style.display='block';<br \/>\n      document.getElementById('myisubject').style.display = 'inline';<br \/>\n      document.getElementById('myiemail').style.display = 'inline';<br \/>\n    context.strokeStyle=document.getElementById('mycolour').value;<br \/>\n    context.beginPath();<br \/>\n    context.moveTo(x,y);<br \/>\n    context.lineTo(lastx,lasty);<br \/>\n    context.stroke();<br \/>\n\t}<br \/>\n    }<br \/>\n    break;<br \/>\n        case \"mouseup\":  if (isScribble == 2) { isScribble=1; } break;<br \/>\n        default: return;<br \/>\n    }<br \/>\n}<br \/>\n<\/b><br \/>\nfunction tryit() {<br \/>\n var tds=document.getElementsByTagName('td'), hstuff='';<br \/>\n if (tds.length > 0) {<br \/>\n    hstuff+=\"&lt;div style='position: absolute; top:600px; left:860px; display:none; background-color: lightgreen; ' id='divan\" + \"notation'&gt;&lt;h4&gt;Your Annotations++&lt;\/h4&gt;\";<br \/>\n    hstuff+=\"&nbsp;&lt;img src='http:\/\/www.rjmprogramming.com.au\/MarkItUp\/line.png' onclick=' doline(); ' alt='Line' title='Line'&gt;&lt;\/img&gt;\";<br \/>\n    hstuff+=\"&nbsp;&lt;img src='http:\/\/www.rjmprogramming.com.au\/MarkItUp\/rectangle.png' onclick=' dorectangle(); ' alt='Rectangle' title='Rectangle'&gt;&lt;\/img&gt;\";<br \/>\n    hstuff+=\"&nbsp;&lt;img src='http:\/\/www.rjmprogramming.com.au\/MarkItUp\/rectangleborder.png' onclick=' dorectangleborder(); ' alt='Rectangle Border' title='Rectangle Border'&gt;&lt;\/img&gt;\";<br \/>\n    hstuff+=\"&nbsp;&lt;img src='http:\/\/www.rjmprogramming.com.au\/MarkItUp\/circle.png' onclick=' docircle(); ' alt='Circle' title='Circle'&gt;&lt;\/img&gt;\";<br \/>\n    hstuff+=\"&nbsp;&lt;img src='http:\/\/www.rjmprogramming.com.au\/MarkItUp\/clear.png' onclick=' clearall(); ' alt='Clear' title='Clear'&gt;&lt;\/img&gt;\";<br \/>\n    hstuff+=\"&nbsp;&lt;img src='http:\/\/www.rjmprogramming.com.au\/MarkItUp\/sline.png' onclick=\\\" alert('Ready to Scribble in two seconds.  Any key stroke stops scribbling.'); setTimeout(intwo,2000); \\\" alt='Scribble' title=''&gt;&lt;\/img&gt;\";<br \/>\n    hstuff+=\"&nbsp;&lt;img src='http:\/\/www.rjmprogramming.com.au\/MarkItUp\/zline.png' onclick=' isScribble=0; ' alt='End of scribble' title='End of scribble'&gt;&lt;\/img&gt;\";<br \/>\n    hstuff+=\"&nbsp;&lt;img src='http:\/\/www.rjmprogramming.com.au\/MarkItUp\/image.png' onclick=\\\" document.getElementById('file').click();  document.getElementById('file').style.display='block'; document.getElementById('dpf').style.display='block'; \\\" alt='Image' title='Image'&gt;&lt;\/img&gt;&lt;input style='display:none;' id='file' type='file' name='file'&gt;&lt;div id=dpf style='display:none;'&gt;&nbsp;&nbsp;&lt;span class='readBytesButtons'&gt;&lt;button style='display:none;' data-endbyte='4' data-startbyte='0'&gt;1-5&lt;\/button&gt;&lt;button style='display:none;' data-endbyte='14' data-startbyte='5'&gt;6-15&lt;\/button&gt;&lt;button style='display:none;' data-endbyte='7' data-startbyte='6'&gt;7-8&lt;\/button&gt;&lt;br&gt;... vs Image URL: &lt;input type='url' value='+' onblur='readUBlob(this.value,0,0);' style='width:60%;'&gt;&lt;\/input&gt;&lt;br&gt;... Offset X: &lt;input style='width:25%;' id='xoff' type='number' value='0'&gt;&lt;\/input&gt; Offset Y: &lt;input style='width:25%;' id='yoff' type='number' value='0'&gt;&lt;\/input&gt;&lt;br&gt;&lt;button onclick='readBlob(0,0);'&gt;Place into Canvas&lt;\/button&gt;&lt;button onclick='readOBlob(0,0);'&gt;Overlay into Canvas&lt;\/button&gt;&lt;\/div&gt;&lt;div id='byte_range' style='display:none;'&gt;&lt;\/div&gt;&lt;div id='byte_content' style='display:none;'&gt;&lt;\/div&gt;&lt;input id='fil' value='' type='hidden'&gt;&lt;\/input&gt;&lt;img id='spareimg' src='' style='display:none;'&gt;&lt;\/img&gt;\";<br \/>\n    hstuff+=\"&lt;br&gt;Annotation (optional): &lt;input onblur='placeannotation(this);' id='iannotation' type='text' value=''&gt;&lt;\/input&gt;&lt;br&gt;&lt;span&gt;Anno B&amp;W (optional): &lt;input onblur='placeannotation(this);' id='jannotation' type='text' value=''&gt;&lt;\/input&gt;&lt;br&gt;Style: &lt;input type='text' id='myfont' value='18px Verdana'&gt;&lt;\/input&gt;&nbsp;&lt;input type='text' id='mycolour' value='black'&gt;&lt;\/input&gt;&lt;\/span&gt;&lt;br&gt;\";<br \/>\n    hstuff+=\"&lt;form style='display:none;' id='myform' method='post' enctype='application\/x-www-urlencoded' action='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.php' target='myiframetwo'&gt;&lt;input type='hidden' name='mysubject' id='mysubject' value='My World Map'&gt;&lt;\/input&gt;&lt;input type='hidden' name='myfname' id='myfname' value=''&gt;&lt;\/input&gt;&lt;input type='submit' id='bsubmit' value='Submit' style='display:none;'&gt;&lt;\/input&gt;&lt;input type='hidden' name='ismobile' id='ismobile' value=''&gt;&lt;\/input&gt;&lt;input type='hidden' name='mode' id='mode' value='1'&gt;&lt;\/input&gt;&lt;input type='hidden' name='to' id='to' value=''&gt;&lt;\/input&gt;&lt;input type='hidden' name='mydurl' id='mydurl' value=''&gt;&lt;\/input&gt;&lt;\/form&gt;\";<br \/>\n    hstuff+=\"&lt;iframe style='display:none;' id='myiframetwo' src='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.php'&gt;&lt;\/iframe&gt;\";<br \/>\n    hstuff+=\"&lt;input style='display:none;' onblur='fixmyemail(this.value + String.fromCharCode(32),1);' type='text' id='myisubject' value='My World Map '&gt;&lt;\/input&gt;&nbsp;&lt;input style='background-color: yellow;' type='button' value='Email (optional)' onclick='  capture(document.getElementById(\" + '\"' + \"mydurl\" + '\"' + \"),document.getElementById(\" + '\"' + \"bsubmit\" + '\"' + \"),document.getElementById(\" + '\"' + \"myemail\" + '\"' + \"));   '&gt;&lt;\/input&gt;&nbsp;&lt;a style='display:none;' target='_blank' id='myemail' href='mailto:fill.in.email@address?subject=My%20World%20Map&body='&gt;&lt;\/a&gt;&lt;input style='display:none;' onblur='fixmyemail(this.value,0);' type='text' id='myiemail' value='' title='Fill this in for emailed attachment'&gt;&lt;\/input&gt;\";<br \/>\n    hstuff+=\"&lt;\/div&gt;\";<br \/>\n    if (tds[eval(-1 + tds.length)].innerHTML.indexOf('diva' + 'nnotaxtion') == -1) tds[eval(-1 + tds.length)].innerHTML+=hstuff;<br \/>\n    var today = new Date();<br \/>\n    var dd = today.getDate();<br \/>\n    var mm = today.getMonth()+1; \/\/January is 0!<br \/>\n    var yyyy = today.getFullYear();<br \/>\n    var hh = today.getHours();<br \/>\n    var minm = today.getMinutes(); \/\/January is 0!<br \/>\n    var ss = today.getSeconds();<br \/>\n    document.getElementById('myfname').value = \"world_\" + yyyy + \"_\" + mm + \"_\" + hh + \"_\" + minm + \"_\" + ss + \".png\";<br \/>\n    document.getElementById('myform').action = document.getElementById('myform').action.replace('?mode=1', '');<br \/>\n    document.getElementById('mode').value = '';<br \/>\n    document.getElementById('ismobile').value = 'y';<br \/>\n    document.getElementById('myisubject').style.display = 'inline';<br \/>\n    document.getElementById('myiemail').style.display = 'inline';<br \/>\n    document.getElementById('myform').action = document.getElementById('myform').action.replace('?mode=1', '');<br \/>\n    document.getElementById('myform').action = document.getElementById('myform').action.replace('mode=1', 'mode=');<br \/>\n    \/\/document.getElementById('myemail').href = '#' + document.getElementById('myemail').href;<br \/>\n }<br \/>\n<b><br \/>\n    document.body.addEventListener('keyup', function(event) {<br \/>\n       if (isScribble == 2 || isScribble == 1) {<br \/>\n        isScribble=0;<br \/>\n       }<br \/>\n    });<br \/>\n<\/b><b><br \/>\n    if (isTouch || isiPad) {<br \/>\n    \/\/elem.addEventListener(\"touchstart\", touchHandler, true);<br \/>\n    elem.addEventListener(\"touchmove\", touchHandler, true);<br \/>\n    elem.addEventListener(\"touchend\", touchHandler, true);<br \/>\n    elem.addEventListener(\"touchcancel\", touchHandler, true);<br \/>\n<\/b><b><br \/>\n    \/\/elem.addEventListener('touchstart', function(event) {<br \/>\n    \/\/   if (isScribble == 1) {<br \/>\n    \/\/    isScribble=2;<br \/>\n    \/\/   }<br \/>\n    \/\/});<br \/>\n<\/b><b><br \/>\n\t} else {<br \/>\n<\/b><b><br \/>\n    elem.addEventListener('mouseup', function(event) {<br \/>\n       if (isScribble == 2) {<br \/>\n        isScribble=1;<br \/>\n       }<br \/>\n    });<br \/>\n<\/b><b><br \/>\n    elem.addEventListener('touchend', function(event) {<br \/>\n       if (isScribble == 2) {<br \/>\n        isScribble=1;<br \/>\n       }<br \/>\n    });<br \/>\n<\/b><b><br \/>\n    elem.addEventListener('touchstart', function(event) {<br \/>\n       if (isScribble == 1) {<br \/>\n        isScribble=2;<br \/>\n       }<br \/>\n    });<br \/>\n<\/b><b><br \/>\n    elem.addEventListener('mousedown', function(event) {<br \/>\n       if (isScribble == 1) {<br \/>\n        isScribble=2;<br \/>\n       }<br \/>\n    });<br \/>\n<\/b><b><br \/>\n    elem.addEventListener('mousemove', function(event) {<br \/>\n       if (isScribble == 2) {<br \/>\n<\/b><b><br \/>\n       if (x == 0 && y == 0 && lastx == 0 && lasty == 0) {<br \/>\n       if (event.pageX || event.pageY) {<br \/>\n       x = event.pageX - elemLeft;<br \/>\n       y = event.pageY - elemTop;<br \/>\n       } else {<br \/>\n       x = event.clientX - elemLeft;<br \/>\n       y = event.clientY - elemTop;<br \/>\n       }<br \/>\n       lastx=x;<br \/>\n       lasty=y;<br \/>\n       } else {<br \/>\n       lastx=x;<br \/>\n       lasty=y;<br \/>\n       if (event.pageX || event.pageY) {<br \/>\n       x = event.pageX - elemLeft;<br \/>\n       y = event.pageY - elemTop;<br \/>\n       } else {<br \/>\n       x = event.clientX - elemLeft;<br \/>\n       y = event.clientY - elemTop;<br \/>\n       }<br \/>\n       }<br \/>\n<\/b><b><br \/>\n    if (x != lastx || y != lasty) {<br \/>\n      document.getElementById('divannotation').style.display='block';<br \/>\n      document.getElementById('myisubject').style.display = 'inline';<br \/>\n      document.getElementById('myiemail').style.display = 'inline';<br \/>\n    context.strokeStyle=document.getElementById('mycolour').value;<br \/>\n    context.beginPath();<br \/>\n    context.moveTo(x,y);<br \/>\n    context.lineTo(lastx,lasty);<br \/>\n    context.stroke();<br \/>\n\t}<br \/>\n    }<br \/>\n<\/b><b><br \/>\n    });<\/b><br \/>\n    }<br \/>\n<b><\/b><br \/>\n<b><\/b><br \/>\nsetTimeout(tryit, 2000);<br \/>\n<\/code><\/p>\n<p> &#8230; as you can see from <a target=_blank title='world.js' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.js--GETME' title='world.js'>this link<\/a>.  Regarding some mobile platform issues we&#8217;d like to thank this <a target=_blank title='Really useful link' href='http:\/\/stackoverflow.com\/questions\/1517924\/javascript-mapping-touch-events-to-mouse-events'>really useful link<\/a> &#8230; so, thanks.  And if actions speak louder than words no doubt you&#8217;ll be wanting the <a target=_blank  href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html' title='click picture'>live run<\/a> link.<\/p>\n<p>As for &#8230;<\/p>\n<blockquote><p>\nWe &#8220;might&#8221; have genericized the world.html changes into other HTMLs of its ilk &#8230; well, we decided against that for now &#8230; but will later &#8230; and partly the reason is that there is more to do, and we just want to concentrate on world.html\n<\/p><\/blockquote>\n<p> &#8230; from last time&#8217;s <a title='Canvas Email Attachment New Image Tutorial' href='#cieaejt'>Canvas Email Attachment New Image  Tutorial<\/a> as shown below, that still remains the case &#8230; there is more to do.  Hope to see you back again for that then.<\/p>\n<hr>\n<p id='cieaejt'>Previous relevant <a target=_blank title='Canvas Email Attachment New Image Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/canvas-email-attachment-new-image-tutorial\/'>Canvas Email Attachment New Image  Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Canvas Email Attachment New Image Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/worldimage.jpg\" title=\"Canvas Email Attachment New Image Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Canvas Email Attachment New Image Tutorial<\/p><\/div>\n<p>When we last left off with <a title='Canvas Image Email Attachment External Javascript Tutorial' href='#cieaejt'>Canvas Image Email Attachment External Javascript Tutorial<\/a> project we posed two ongoing &#8220;trailers&#8221;\/&#8221;spoiler alerts&#8221; &#8230;<\/p>\n<ul>\n<li>We &#8220;might&#8221; have genericized the world.html changes into other HTMLs of its ilk &#8230; well, we decided against that for now &#8230; but will later &#8230; and partly the reason is that there is more to do, and we just want to concentrate on world.html with &#8230;<\/li>\n<li>Did you guess what functionality we might want to do next?  We want to allow the user to &#8220;overlay&#8221; or &#8220;clobber&#8221; the existing canvas&#8217;s map image with an image of their choosing in one of two entry methods &#8230;\n<ol>\n<li>via a Browse button selection of an image on their computer &#8230; or &#8230;<\/li>\n<li>via the specification of a URL pointing at an image (on the web, probably)<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>We&#8217;ve grappled with the relatively newly arrived brilliance of HTML5 with ideas off Browse buttons and their manipulation of file data, the methods of which don&#8217;t even need PHP or ASP.Net (or any other server side language) to proceed &#8230; cute, huh?!  We referenced this <a target=_blank href='http:\/\/www.html5rocks.com\/en\/tutorials\/file\/dndfiles\/' title='Great link'>great link<\/a> when we presented <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/phphtmljavascript-image-file-browsing-primer-tutorial-2'>PHP\/HTML\/Javascript Media &#038; Document File Browse Tutorial<\/a>, and you may want to reference that regarding the useful Javascript HTML5 FileReader methods. Another <a target=_blank title='Another useful link' href='http:\/\/stackoverflow.com\/questions\/4773966\/drawing-an-image-from-a-data-url-to-a-canvas'>really useful link<\/a> for today&#8217;s work is &#8230; what we just linked &#8230; we presume &#8230; thanks. We find FileReader.readAsDataURL() method to be just what we want today to take the data of a file as a data URL and be able to use the canvas.<a target=_blank title='HTML canvas element drawImage() method information from w3schools' href='http:\/\/www.w3schools.com\/tags\/canvas_drawimage.asp'>drawImage<\/a>() to place that image data onto the canvas by &#8220;overlaying&#8221; it or &#8220;clobbering&#8221; it.<\/p>\n<p>Our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html-----GETME\" title='world.html'>world.html<\/a> did not need to change for this new image friendly functionality but our external Javascript you could call <a target=_blank title='world.js' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.js-GETME' title='world.js'>world.js<\/a> changed quite a bit as you can see from <a target=_blank title='world.js' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.js-GETME' title='world.js'>this link<\/a>.<\/p>\n<p>To envisage all this, you really should try a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html\" title='Click picture'>live run<\/a> of our interactive World Map (with Annotation and Email Attachment functionality) web application.  We hope some Browse button thoughts start springing forth from the bit below the hair (or if you&#8217;re standing on your head right now &#8230; the bit above the hair).<\/p>\n<hr>\n<p id='cieaejt'>Previous relevant <a target=_blank title='Canvas Image Email Attachment External Javascript Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/canvas-image-email-attachment-external-javascript-tutorial\/'>Canvas Image Email Attachment External Javascript Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Canvas Image Email Attachment External Javascript Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/worldmore.jpg\" title=\"Canvas Image Email Attachment External Javascript Tutorial\" id='iyt' onmouseover=\" this.src=this.src.replace('.jpg','.xjpeg').replace('.jpeg','.xjpg').replace('.xj','.j') ; \" \/><\/a><p class=\"wp-caption-text\">Canvas Image Email Attachment External Javascript Tutorial<\/p><\/div>\n<p>Rome wasn&#8217;t built in a day &#8230; just read &#8220;SPQR <font size=1>A History of Ancient Rome<\/font>&#8221; by Mary Beard, to confirm that.  And software takes time, and often revisits and rethinks, in between, running it past people, perhaps.  So it is with the build up of our &#8220;cause&#8221;, which we&#8217;ll eventually reveal, that started with <a title='Canvas Image Email Attachment Primer Tutorial' href='#cieapt'>Canvas Image Email Attachment Primer Tutorial<\/a> as shown below, and moves on today, in two directions &#8230;<\/p>\n<ul>\n<li>Organization wise &#8230; we move some of the &#8220;Annotation++&#8221; functionality specifics to external Javascript &#8230; via &#8230;<br \/>\n<code><br \/>\n&lt;script type='text\/javascript' src='world.js' defer&gt;&lt;\/script&gt;<br \/>\n<\/code><br \/>\n&#8230; to be more modular, and to apply it to other web applications like world.html that aren&#8217;t world.html (which we will also do event-U-al-ly &#8230; maybe even today?! &#8230; you&#8217;ll see at the end of this blog posting if we have)<\/li>\n<li>Functionality wise &#8230; we allow for more than &#8220;Annotations&#8221; now &#8230; hence the &#8220;Annotation++&#8221; notation above &#8230; we&#8217;ve been delving into our HTML canvas codes for logic to draw lines and rectangles (including a &#8220;huge white rectangle&#8221; to &#8220;clear&#8221; the canvas) and circles today\n<\/ul>\n<p>When you redesign arrangements this way, you should retest all the functionality combinations to make sure you haven&#8217;t broken anything &#8230; because that would be kinda&#8217; <a target=_blank title='stUpid' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/image-thumbnail-presentation-primer-tutorial\/'>stUpid<\/a>.  The adage should be that you leave things better than when you start, to do a good job &#8230; doh!<\/p>\n<p>So there&#8217;s still an important bit of &#8220;base&#8221; functionality missing, and we&#8217;ll get to that next time, though maybe you&#8217;ve guessed what it would be yourself?!<\/p>\n<p>So take a look at our HTML and Javascript and CSS <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html-----GETME\" title='world.html'>world.html<\/a> which changed as per <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html-----GETME\" title='world.html'>this link<\/a> which now calls on new external Javascript you could call <a target=_blank title='world.js' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.js_GETME' title='world.js'>world.js<\/a> if you like.  Unchanged is the concept (and the content) regarding the HTML using PHP server side code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.php_GETME\" title='world.php'>world.php<\/a> within an HTML <a target=_blank title='HTML iframe element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>iframe<\/a> element.  Again, please don&#8217;t think you&#8217;ll be able to achieve this functionality just with client-side Javascript.  It involves server data.  So here is a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html\" title='Click picture'>live run<\/a> link in order for you to try this new functionality, which kicks into action from the second canvas click\/touch, and on.<\/p>\n<p>Hint: Don&#8217;t be shy to try some <i>&#8220;rgba([red0-255],[blue0-255],[green0-255],[opacity0.0-1.0])&#8221;<\/i> <i>colour<\/i> field possibilities in combination with the filled in <i>rectangle<\/i> option to improve your &#8220;overlay&#8221; functionality possibilities, as with today&#8217;s main <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/worldmore.jpg\">tutorial picture<\/a>.<\/p>\n<hr>\n<p id='cieapt'>Previous relevant <a target=_blank title='Canvas Image Email Attachment Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/canvas-image-email-attachment-primer-tutorial\/'>Canvas Image Email Attachment Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Canvas Image Email Attachment Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.jpeg\" title=\"Canvas Image Email Attachment Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Canvas Image Email Attachment Primer Tutorial<\/p><\/div>\n<p>Maybe you remember the series of blog postings that we last visited with <a title='HTML5 Canvas Map Clickaround Onresize Tutorial' href='#hcmcot'>HTML5 Canvas Map Clickaround Onresize Tutorial<\/a> some time ago?  We&#8217;ve been, over the last couple of days, working out how to &#8230;<\/p>\n<ul>\n<li>take an HTML <a target=_blank title='HTML Canvas element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>canvas<\/a> element&#8217;s [canvasContext].drawImage() image<\/li>\n<li>be able to overlay some interactively entered textual annotations over the top of user entered rectangle corners<\/li>\n<li>take a snapshot of this canvas with its annotations via [canvasContext].<a target=_blank title='HTML5 canvas element toDataURL method information' href='https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/HTMLCanvasElement\/toDataURL'>toDataURL<\/a>() (woh!)<\/li>\n<li>use an HTML form element with method=POST target=myiframetwo to post the data to our (new) PHP (featuring the use of <a target=_blank title='Good php:\/\/input information ... thanks' href='http:\/\/getluky.net\/2009\/02\/24\/php-_post-array-empty-although-phpinput-and-raw-post-data-is-available\/'>php:\/\/input<\/a> for the first time, for us anyway) &#8230; which &#8230;<\/li>\n<li>emails that snapshot to someone<\/li>\n<\/ul>\n<p>We allow for &#8230;<\/p>\n<ol>\n<li>non-mobile platforms to use their email clients, perhaps, via a body link to an image file stored on the rjmprogramming.com.au domain web server &#8230; or, because such functionality is awkward for mobile platforms, we &#8230;<\/p>\n<li>allow for the canvas contents be turned into image data that can be used as the data for an email attachment, thus allowing the web server to not have to store the data (there) now<\/li>\n<\/ol>\n<p>Here&#8217;s some of the PHP code to create that email with its attachment, for your perusal (where $idata has that data URL data of the canvas&#8217;s contents, that is image\/png data (in base64)) &#8230;<\/p>\n<p><code><br \/>\n        \/\/$headers = 'From: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;<br \/>\n        $headers = 'Reply-To: ' . 'rmetcalfe@rjmprogramming.com.au' . $eol;<br \/>\n                   \/\/     'X-Mailer: PHP\/' . phpversion();<br \/>\n        $contents = \"\";<br \/>\n        if ($idata != \"\") $contents = $idata;<br \/>\n        if (strpos('~' . $mybody, '~http') !== false || $contents != \"\") {<br \/>\n          if ($contents == \"\") $contents = @file_get_contents($mybody);<br \/>\n          if ($contents != '') {<br \/>\n\/\/<br \/>\n    \t\tdate_default_timezone_set('Australia\/Perth');<br \/>\n\/\/<br \/>\n            \/\/$mysubject .= ' ... ' . $mybody;<br \/>\n    \t\t$fs = explode(\"\/\", $mybody);<br \/>\n    \t\t$filename = $fs[-1 + sizeof($fs)];<br \/>\n    \t\t$content = chunk_split(base64_encode($contents));<br \/>\n\/\/<br \/>\n    \t\t\/\/ a random hash will be necessary to send mixed content<br \/>\n    \t\t$separator = md5(time());<br \/>\n\/\/<br \/>\n    \t\t$headers .= \"MIME-Version: 1.0\" . $eol;<br \/>\n    \t\t$headers .= \"Content-Type: multipart\/mixed; boundary=\\\"\" . $separator . \"\\\"\" . $eol . $eol;<br \/>\n    \t\t$headers .= \"Content-Transfer-Encoding: 7bit\" . $eol;<br \/>\n    \t\t$headers .= \"This is a MIME encoded message.\" . $eol . $eol;<br \/>\n\/\/<br \/>\n    \t\t\/\/ message<br \/>\n    \t\t$headers .= \"--\" . $separator . $eol;<br \/>\n    \t\t$headers .= \"Content-Type: text\/plain; charset=\\\"iso-8859-1\\\"\" . $eol;<br \/>\n    \t\t$headers .= \"Content-Transfer-Encoding: 8bit\" . $eol . $eol;<br \/>\n\/\/<br \/>\n    \t\t$headers .= \"Please see attached image below:\" . $eol . $eol;<br \/>\n\/\/<br \/>\n    \t\t\/\/ attachment<br \/>\n    \t\t$headers .= \"--\" . $separator . $eol;<br \/>\n    \t\t$headers .= \"Content-Type: application\/octet-stream; name=\\\"\" . $filename . \"\\\"\" . $eol;<br \/>\n    \t\t$headers .= \"Content-Transfer-Encoding: base64\" . $eol;<br \/>\n    \t\t$headers .= \"Content-Disposition: attachment;filename=\\\"\" . $filename . \"\\\"\" . $eol;<br \/>\n    \t\t$headers .= $content . $eol . $eol;<br \/>\n    \t\t$headers .= \"--\" . $separator . \"--\";<br \/>\n\/\/<br \/>\n            ourpremail($tem, $mysubject, \"\", $headers); \/\/ emails to $tem<br \/>\n          }<br \/>\n        }<br \/>\n<\/code><\/p>\n<p>And so, with our <i>proof of concept<\/i> ideas, the world becomes <i>(hopefully, lots of)<\/i> our <i>(collective)<\/i> oyster<i>(s)<\/i>, given a little imagination, here.  Really, take a look at our HTML and Javascript and CSS <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html----GETME\" title='world.html'>world.html<\/a> which changed as per <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html----GETME\" title='world.html'>this link<\/a>.  It has new PHP server side code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.php_GETME\" title='world.php'>world.php<\/a> within an HTML <a target=_blank title='HTML iframe element information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>iframe<\/a> element.  Please don&#8217;t think you&#8217;ll be able to achieve this functionality just with client-side Javascript.  It involves server data.  So here is a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html\" title='Click picture'>live run<\/a> link in order for you to try this new functionality, which kicks into action from the second canvas click\/touch, and on.<\/p>\n<hr>\n<p id='hcmcot'>Previous relevant <a target=_blank title='HTML5 Canvas Map Clickaround Onresize Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html5-canvas-map-clickaround-onresize-tutorial\/'>HTML5 Canvas Map Clickaround Onresize Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/cloudy_world.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"HTML5 Canvas Map Clickaround Overlay Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/cloudy_world_resize.jpg\" title=\"HTML5 Canvas Map Clickaround Overlay Tutorial\"   \/><\/a><p class=\"wp-caption-text\">HTML5 Canvas Map Clickaround Overlay Tutorial<\/p><\/div>\n<p>Yesterday we came back after quite some time in the (PHP) server world to some client (Javascript and HTML) work, and today, after yesterday&#8217;s <a target=_blank title='HTML5 Canvas Map Clickaround Overlay Tutorial' href='#hcmcot'>HTML5 Canvas Map Clickaround Overlay Tutorial<\/a> as shown below, we tackle a client Javascript event, the <a target=_blank title='Javascript onresize event information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/event_onresize.asp'>&#8220;onresize&#8221;<\/a> event (best intervened with in terms of looking at the Javascript DOM &#8220;window&#8221; object rather than the &#8220;document&#8221; object), that is often &#8220;left until last&#8221; in a programmer&#8217;s mind &#8230; and often not thought about at all.  That&#8217;s often me &#8230; but not today.<\/p>\n<p>Perhaps the reason it is (often) neglected is that the design (you&#8217;ve come up with) leaves lots of room, and the styling &#8220;position:absolute;&#8221; concept is not used at all with your web application.  Yesterday, though, &#8220;position:absolute;&#8221; is pivotal to the working of the web application, as is the positioning of the HTML canvas element at (0,0) &#8230; why? &#8230; the slightly glib answer here is that to complicate life is to complicate your web application, and if you can cater for the simple case, why not work with that simple case, with its simplified coding logic?<\/p>\n<p>Okay, so what&#8217;s the scenario with yesterday&#8217;s <a target=_blank title='HTML5 Canvas Map Clickaround Overlay Tutorial' href='#hcmcot'>HTML5 Canvas Map Clickaround Overlay Tutorial<\/a> where the Javascript &#8220;onresize&#8221; event gets triggered.  On a laptop or desktop computer, it is when you &#8220;drag&#8221; (a window corner) and, we anticipate, shrink your window (by then &#8220;dropping&#8221; (a window corner)) to end up with a window smaller than the set established size, width or height, we cater for with the HTML canvas element&#8217;s width or height.<\/p>\n<p>Now we currently rely on the right hand side being the user controlling side, but if a user shrinks the window, and we refuse to get into any &#8220;zooming&#8221; logic &#8230; my strong advice is not to go there &#8230; you have two choices to my mind &#8230;<\/p>\n<ol>\n<li>&#8220;copy&#8221; the right hand HTML (into an existant blank HTML div element&#8217;s innerHTML) and &#8220;overlay&#8221; at (0,0) (with less opacity than the rest)<\/li>\n<li>&#8220;copy&#8221; the right hand HTML and use Javascript (where myWidth is calculated width of the HTML canvas element &#8230; remember this functionality from yesterday?) &#8230; and use <i>window.open(&#8220;&#8221;,&#8221;Title&#8221;,&#8221;top=0px,left=&#8221; + eval(20 + myWidth) + &#8220;px,width=350px,height=600px&#8221;)<\/i> (along with a global var<font size=1>iable<\/font> <i>wadd<\/i>) &#8230; for a popup window, as per &#8230;<br \/>\n<code><br \/>\nwadd = window.open(\"\",\"Your Place and Airports Map Goes Here ...\",\"top=0px,left=\" + eval(20 + myWidth) + \"px,width=350px,height=600px\");<br \/>\n<\/code> and then use <i>wadd.document.write([someHTML])<\/i> &#8230; as per &#8230;<br \/>\n<code><br \/>\nvar newhtml=\"&lt;!doctype html&gt;&lt;html&gt;&lt;head&gt;\" + document.head.innerHTML + \"&lt;\/head&gt;&lt;body&gt;\" + document.getElementById('dhuh').innerHTML.replace(\/opacity:0.0;\/g, \"opacity:1.0;\").replace('\"Cloudy\"', '').replace('id=\"myqiframe', 'id=\"myiframe').replace('id=\"mypqiframe', 'id=\"mypiframe').replace('id=\"myqa', 'id=\"mya');<br \/>\nwadd.document.write(newhtml);<br \/>\n<\/code>\n<\/ol>\n<p>You&#8217;ve probably guessed by the added detail in the second of above, the first idea was awkward, but if you want to pursue it yourself, via leads, look for the (left in) <i>if (additional != &#8221;) { } <\/i> logic parts in the HTML\/Javascript coding of <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/cloudy_world.html-----GETME\" title='cloudy_world.html'>cloudy_world.html<\/a> (or try the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/cloudy_world.html\" title='cloudy_world.html'>live run<\/a>).<\/p>\n<p>We later use a Javascript <i>setTimeout()<\/i> call to wait a while while the hidden right hand side&#8217;s HTML <i>iframe<\/i> element is filled out with the Airport Data Near Your World Map Clicked Position, and through that knowledge over to the &#8220;wadd&#8221; window (where it is viewable, presumably &#8230; unless you&#8217;ve repositioned again (which is okay to test if you want)).<\/p>\n<p>So, today, everything should be as per yesterday with no &#8220;resizing&#8221; (and of course the programmer adage to &#8220;not make things backward in functionality&#8221; would tell you that to hold onto this &#8220;tooth and nail&#8221; should be thought of as extremely important &#8230; probably of higher priority than any new functionality &#8230; think probably users get pretty annoyed by things that used to work, not working later, because of your own newly introduced bug).<\/p>\n<p>It <i><b>behoves<\/b><\/i> me, <i><b>my liege<\/b><\/i>, to leave you with the HTML\/Javascript code differences, to make this happen, from yesterday, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/cloudy_world.html-----GETME\" title=\"cloudy_world.html\">here<\/a>, and we hope it helps you in some small way.  We also want to thank the &#8220;powers that be&#8221; for the excellent advice at <a target=_blank title='useful link ... thanks' href='http:\/\/stackoverflow.com\/questions\/12596299\/how-to-get-height-and-width-after-window-resize'>this link<\/a>, for this topic &#8230; thanks, as always.<\/p>\n<hr>\n<p id='hcmcot'>Previous relevant <a target=_blank title='HTML5 Canvas Map Clickaround Overlay Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html5-canvas-map-clickaround-overlay-tutorial\/'>HTML5 Canvas Map Clickaround Overlay Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/cloudy_world.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"HTML5 Canvas Map Clickaround Overlay Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/cloudy_world.jpg\" title=\"HTML5 Canvas Map Clickaround Overlay Tutorial\"   \/><\/a><p class=\"wp-caption-text\">HTML5 Canvas Map Clickaround Overlay Tutorial<\/p><\/div>\n<p>After some time in the (PHP) server world, it&#8217;s time to dive back into some client (Javascript and HTML) work, in this client\/server world of web applications.<\/p>\n<p>Today we revisit the &#8220;overlay&#8221; theme of blog postings, as the web application world is full of possibilities for overlay ideas.<\/p>\n<p>This time we overlay an HTML div element completely on top of an HTML canvas element, with some opacity (or some transparency), during the body &#8220;onload&#8221; event.  We do not adjust the DOM <a target=_blank title='CSS z-index information from w3schools' href='http:\/\/www.w3schools.com\/cssref\/pr_pos_z-index.asp'>&#8220;z-index&#8221;<\/a> style property for either element.  So what happens in this scenario when you click on this &#8220;multiple&#8221; HTML element combination?  Well, it pans out you click on the HTML div element, so we have another task to do at the body &#8220;onload&#8221; event, to see things right, regarding the working of this web application, which starts where we left off with <a target=_blank title='HTML5 Canvas Map Clickaround Follow Up Tutorial' href='#hcmcfut'>HTML5 Canvas Map Clickaround Follow Up Tutorial<\/a> as shown below.<\/p>\n<p>From this basis, this is how we got to today &#8230; there was HTML <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/cloudy_world.html----GETME\" title=\"cloudy_world.html\">cloudy_world.html<\/a> that changed like <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/cloudy_world.html----GETME\" title=\"cloudy_world.html\">here<\/a>.<\/p>\n<p>You&#8217;ll see in the code above some great code presented at <a target=_blank href='http:\/\/help.dottoro.com\/ljvmcrrn.php' title='useful link ... thanks'>useful link<\/a> (thanks) which is great for defining an HTML element&#8217;s size via &#8230;<\/p>\n<p><code><br \/>\n        function SetBox(what) {<br \/>\n            var div = document.getElementById(what);<br \/>\n            if (div.<a target=_blank title='getBoundingClientRect' href='https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Element\/getBoundingClientRect'>getBoundingClientRect<\/a>) {        \/\/ Internet Explorer, Firefox 3+, Google Chrome, Opera 9.5+, Safari 4+<br \/>\n              \/\/ do stuff<br \/>\n            }<br \/>\n        }<br \/>\n<\/code><\/p>\n<p> &#8230; and we hope you can see that the implications for &#8220;overlay&#8221; ideas you have are huge &#8230; and that is fine &#8230; but you may wonder how the HTML div element is made to drape right over <i>all<\/i> the canvas element &#8230; well, it uses styling as per &#8230;<\/p>\n<ul>\n<li>position: absolute;<\/li>\n<li>top and left and width and height parameters are all defined<\/li>\n<li>borderTop defined as having a size the same as height above as per our HTML div id=&#8217;boxdiv&#8217; element &#8230;<br \/>\n<code><br \/>\n                document.getElementById('boxdiv').style.position = 'absolute';<br \/>\n                document.getElementById('boxdiv').style.top = y + \"px\";<br \/>\n                document.getElementById('boxdiv').style.left = x + \"px\";<br \/>\n                document.getElementById('boxdiv').style.width = w + \"px\";<br \/>\n                document.getElementById('boxdiv').style.height = h + \"px\";<br \/>\n                document.getElementById('boxdiv').style.borderTop = h + 'px solid rgba(255,255,255,0.5)';<br \/>\n<\/code><\/li>\n<\/ul>\n<p> &#8230; and you&#8217;ll also see with the code how the HTML div id=&#8217;boxdiv&#8217; element&#8217;s &#8220;onclick&#8221; details are transferred to the (effectively underlying) HTML canvas element, where all the previous business logic of the web application resided, and continues to function (once you make variables &#8220;x&#8221; and &#8220;y&#8221; global and control how they are derived at the HTML div id=&#8217;boxdiv&#8217; element&#8217;s &#8220;onclick&#8221; event logic).<\/p>\n<p>So please try the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/cloudy_world.html\" title='Click picture'>live run<\/a> to see all this in action.<\/p>\n<hr>\n<p id='hcmcfut'>Previous relevant <a target=_blank title='HTML5 Canvas Map Clickaround Follow Up Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html5-canvas-map-clickaround-follow-up-tutorial\/'>HTML5 Canvas Map Clickaround Follow Up Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.htm\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"HTML5 Canvas Map Clickaround Follow Up Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.gif\" title=\"HTML5 Canvas Map Clickaround Follow Up Tutorial\"   \/><\/a><p class=\"wp-caption-text\">HTML5 Canvas Map Clickaround Follow Up Tutorial<\/p><\/div>\n<p>HTML5 brought in the incredibly useful <a target=_blank title='HTML5 canvas information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_canvas.asp'>&#8220;canvas&#8221;<\/a> element, for the first time.  Its existence opens up a whole new world of possibilities for web applications that are graphical by nature, as we saw yesterday with <a target=_blank title='HTML5 Canvas Map Clickaround Primer Tutorial' href='#hcmcpt'>HTML5 Canvas Map Clickaround Primer Tutorial<\/a> as shown below.  Today, we extend that functionality as of yesterday, by adding the use of a public data feed to enhance the information we present with the Google Map <a target=_blank title='HTML iframe information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_iframe.asp'>&#8220;iframe&#8221;<\/a> we use, and for this we need to thank, profusely, <a target=_blank title='The Global Airport Database' href='http:\/\/www.partow.net\/miscellaneous\/airportdatabase\/'>The Global Airport Database<\/a> project by Arash Partow &#8230; thanks very much.  Now this database (really a file), as you can imagine, has data that changes over time, so is probably best used as a data feed.  Nevertheless, the exercise of using it as a snapshot is useful, and we go ahead and show the nearest 4 airports on the database, in that Google Map &#8220;iframe&#8221; as of April, 2015.<\/p>\n<p>This involved the use of PHP (<a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/intair.php_GETME\" title=\"intair.php\">intair.php<\/a>) to read the file and parse it, which wasn&#8217;t hard as it contains well formed &#8220;:&#8221; delimited data, and there is just the check needed for security hidden data given a latitude and longitude of zero &#8230; unless I&#8217;m mistaken, and where the <a target=_blank title='Coriolis effect information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Coriolis_effect'>water goes down the sink the other way<\/a> as you cross the equator due south of London has several hundred microscopic airports run by ants &#8230; what a movie script?!<\/p>\n<p>With the canvas element&#8217;s <a target=_blank title='HTML5 canvas drawImage() method information from w3schools' href='http:\/\/www.w3schools.com\/tags\/canvas_drawimage.asp'>drawImage()<\/a> method, we use to position the image map of interest, you can draw more than your own geometrical constructs, you can have an image, and that image could be a map, as for today&#8217;s &#8220;World Clickaround&#8221; web application (with access to maps of Brazil and Ireland and United States of America too), where you click on the map (and thanks to <a target=_blank href='http:\/\/www.mapsofworld.com' title='mapsofworld.com'>mapsofworld.com<\/a> for downloadable free maps here) to show a Google Map of interest via <a target=_blank title='Google Chart Map Chart' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4832'>Google Chart Map Chart<\/a>.  Maybe you can use the map of the World to &#8230;<\/p>\n<ul>\n<li>plan a trip<\/li>\n<li>look up where relatives live<\/li>\n<li>count the fire hydrants in Monaco<\/li>\n<\/ul>\n<p>This web application calls on tiny bits of mapping knowledge, namely the &#8220;orientation&#8221; of your &#8220;map&#8221;, as you are effectively <a target=_blank title='Hard Copy Digitizing for Ordnance Survey' href='http:\/\/www.rjmprogramming.com.au\/MyBusinessEins\/Media\/Pages\/Movie.html'>digitizing<\/a> to show where you want your Google Map to zoom in on.<\/p>\n<p>Please have a go of our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.htm\" title=\"Click picture\">live run<\/a> or download the HTML programming source code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html-GETME\" title=\"world.htm\">world.htm<\/a> (<a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/brazil.html-GETME\" title=\"brazil.htm\">brazil.htm<\/a>, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ireland.html-GETME\" title=\"ireland.htm\">ireland.htm<\/a>, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/united_states.html-GETME\" title=\"united_states.htm\">united_states.htm<\/a>), or do both?!<\/p>\n<p>From yesterday, this is how we got to today &#8230; there was new PHP you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/intair.php_GETME\" title=\"intair.php\">intair.php<\/a> &#8230; and then there was changed HTML, the changes for which look like &#8230; <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html-GETME\" title=\"world.htm\">world.htm<\/a>, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/brazil.html-GETME\" title=\"brazil.htm\">brazil.htm<\/a>, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ireland.html-GETME\" title=\"ireland.htm\">ireland.htm<\/a>, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/united_states.html-GETME\" title=\"united_states.htm\">united_states.htm<\/a><\/p>\n<hr>\n<p id='hcmcpt'>Previous relevant <a target=_blank title='HTML5 Canvas Map Clickaround Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=14234'>HTML5 Canvas Map Clickaround Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ireland.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"HTML5 Canvas Map Clickaround Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ireland.png\" title=\"HTML5 Canvas Map Clickaround Primer Tutorial\"   \/><\/a><p class=\"wp-caption-text\">HTML5 Canvas Map Clickaround Primer Tutorial<\/p><\/div>\n<p>HTML5 brought in the incredibly useful <a target=_blank title='HTML5 canvas information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_canvas.asp'>&#8220;canvas&#8221;<\/a> element, for the first time.  Its existence opens up a whole new world of possibilities for web applications that are graphical by nature.<\/p>\n<p>With the canvas element&#8217;s <a target=_blank title='HTML5 canvas drawImage() method information from w3schools' href='http:\/\/www.w3schools.com\/tags\/canvas_drawimage.asp'>drawImage()<\/a> method you can draw more than your own geometrical constructs, you can have an image, and that image could be a map, as for today&#8217;s &#8220;Ireland Clickaround&#8221; web application (with access to maps of Brazil and United States of America and the World too), where you click on the map (and thanks to <a target=_blank href='http:\/\/www.mapsofworld.com' title='mapsofworld.com'>mapsofworld.com<\/a> for downloadable free maps here) to show a Google Map of interest via <a target=_blank title='Google Chart Map Chart' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4832'>Google Chart Map Chart<\/a>.  Maybe you can use the map of Ireland to &#8230;<\/p>\n<ul>\n<li>plan a trip<\/li>\n<li>look up where relatives live<\/li>\n<li>imagine you&#8217;re in O&#8217;Connell Street<\/li>\n<\/ul>\n<p>This web application calls on tiny bits of mapping knowledge, namely the &#8220;orientation&#8221; of your &#8220;map&#8221;, as you are effectively <a target=_blank title='Hard Copy Digitizing for Ordnance Survey' href='http:\/\/www.rjmprogramming.com.au\/MyBusinessEins\/Media\/Pages\/Movie.html'>digitizing<\/a> to show where you want your Google Map to zoom in on.<\/p>\n<p>This is one of those occasions that your (simple) software is a lot more effective using the <a target=_blank title='Mercator map projection information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Mercator_projection'>Mercator<\/a> map projection (that exaggerates the polar areas (like you might have had at school) because the simple latitude and longitude distances everywhere are the same (but relative areas definitely are not (ie. much bigger than reality near the poles))).   Unfortunately, our United States of America projection is not Mercator, but you&#8217;ll still get a &#8220;ball park&#8221; Google Maps feel.<\/p>\n<p>So we can have it that if the user doesn&#8217;t zoom, they need no orientation checks, but otherwise we need to determine a scale, by the user clicking on Dublin, on the map, and from that, we can work out the scaling that needs to be applied, as the top left co-ordinate is arranged to be (0,0) via the <i>style=&#8221;position: absolute; top:0; left:0; &#8220;<\/i> part of &#8230;<\/p>\n<p><code><br \/>\n&lt;canvas id=\"canvaselement\" width=600 height=600 style=\"position: absolute; top:0; left:0; \" \/&gt;<br \/>\n<\/code><\/p>\n<p>Please have a go of our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ireland.html\" title=\"Click picture\">live run<\/a> or download the HTML programming source code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/ireland.html_GETME\" title=\"ireland.html\">ireland.html<\/a> (<a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/brazil.html_GETME\" title=\"brazil.html\">brazil.html<\/a>, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/united_states.html_GETME\" title=\"united_states.html\">united_states.html<\/a>, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/world.html_GETME\" title=\"world.html\">world.html<\/a>), or do both?!<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#14234' onclick='var dv=document.getElementById(\"d14234\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=canvas\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d14234' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#14261' onclick='var dv=document.getElementById(\"d14261\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=land-surveying\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d14261' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#15191' onclick='var dv=document.getElementById(\"d15191\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=overlay\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d15191' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#15208' onclick='var dv=document.getElementById(\"d15208\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=Javascript\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d15208' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d20793' onclick='var dv=document.getElementById(\"d20793\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/attachment\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d20793' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d20862' onclick='var dv=document.getElementById(\"d20862\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/external-javascript\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d20862' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d21005' onclick='var dv=document.getElementById(\"d21005\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/html5\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d21005' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d21020' onclick='var dv=document.getElementById(\"d21020\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/mouse\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d21020' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d21038' onclick='var dv=document.getElementById(\"d21038\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/array\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d21038' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A web application allowing user defined Annotations is better when there is an &#8220;Undo&#8221; and &#8220;Redo&#8221; functionality option. This is because with any user intervention, there can be erroneous work, which sometimes can be a real pain to recover from &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/canvas-annotation-email-attachment-undo-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,37],"tags":[1832,103,111,184,297,380,409,1840,576,578,745,812,894,932,997,1843,1841,1319,1842],"class_list":["post-21038","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-annotation","tag-array","tag-attachment","tag-canvas","tag-data-url","tag-email","tag-external-javascript","tag-filereader","tag-html","tag-html5","tag-map","tag-mouse","tag-overlay","tag-php","tag-programming","tag-redo","tag-scribble","tag-tutorial","tag-undo"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/21038"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=21038"}],"version-history":[{"count":12,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/21038\/revisions"}],"predecessor-version":[{"id":21050,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/21038\/revisions\/21050"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=21038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=21038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=21038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}