{"id":7591,"date":"2014-05-08T05:09:40","date_gmt":"2014-05-07T19:09:40","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=7591"},"modified":"2014-05-08T05:09:40","modified_gmt":"2014-05-07T19:09:40","slug":"htmljavascript-canvas-double-click-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/htmljavascript-canvas-double-click-tutorial\/","title":{"rendered":"HTML\/Javascript Canvas Double Click Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/fraction_withdoubleclick_chalkboard.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"HTML\/Javascript Canvas Double Click Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/fraction_withdoubleclick_chalkboard.jpg\" title=\"HTML\/Javascript Canvas Double Click Tutorial\"  \/><\/a><p class=\"wp-caption-text\">HTML\/Javascript Canvas Double Click Tutorial<\/p><\/div>\n<p>The Canvas HTML element tag can be used as the container to draw graphics on the fly usually via the use of Javascript functions for rendering and event management.<\/p>\n<p>In today&#8217;s tutorial we add to the functionality of the previous <a target=_blank title='HTML\/Javascript Canvas Fractions Game Tutorial' href='#hjcfgt'>HTML\/Javascript Canvas Fractions Game Tutorial<\/a>, as shown below, where we draw an image on the canvas via drawImage() method, by, today, allowing the user to have additional optional double click functionality (on iOS we say &#8220;use any gesture&#8221;) to add some other advice or help prior to the user attempting their answer to the mathematical fractions question posed on the chalkboard (via advice regarding coding logic (thanks) based on <a target=_blank title='[Solved] How to create Event to dynamic canvas? - CodeProject' href='http:\/\/www.codeproject.com\/Questions\/691499\/How-to-create-Event-to-dynamic-canvas'>link<\/a> here).<\/p>\n<p>You may want to read more at <a target=_blank title='HTML Canvas Reference' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>HTML Canvas Reference<\/a> as a generic reference, or here, at the tutorial <a target=_blank title='javascript - How do I add a simple onClick event handler to a canvas element? - Stack Overflow' href='http:\/\/stackoverflow.com\/questions\/9880279\/how-do-i-add-a-simple-onclick-event-handler-to-a-canvas-element'>javascript &#8211; How do I add a simple onClick event handler to a canvas element? &#8211; Stack Overflow<\/a>.<\/p>\n<p>As you can imagine, this HTML canvas element, new to HTML5, can be very useful for some practical client-side web functionality.<\/p>\n<p>Link to some downloadable HTML programming code &#8230; rename to <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/fraction_withdoubleclick_chalkboard.html_GETME' title='fraction_withdoubleclick_chalkboard.html'>fraction_withdoubleclick_chalkboard.html<\/a>\n<\/p>\n<p>You&#8217;ll notice heavy use of the Javascript <a target=_blank title='Javascript Math.random() information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/jsref_random.asp'>Math.random()<\/a> function.<\/p>\n<p>We hope you enjoy this tutorial as a <a target=_blank title='Canvas HTML element live run tutorial'  href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/fraction_withdoubleclick_chalkboard.html\">live run<\/a>.<\/p>\n<p>Almost finally, need to thank a great link for coding ideas with this tutorial, here, at this <a target=_blank title='[Solved] How to create Event to dynamic canvas? - CodeProject' href='http:\/\/www.codeproject.com\/Questions\/691499\/How-to-create-Event-to-dynamic-canvas'>link<\/a>.<\/p>\n<p>Finally, have a look at the differences in code that arrived at this extra canvas double click functionality  (on iOS we say &#8220;use any gesture&#8221;) by examining <a target=_blank title='fraction_withdoubleclick_chalkboard.html' href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/fraction_chalkboard.html-GETME\">fraction_withdoubleclick_chalkboard.html<\/a> link.<\/p>\n<p>Yes &#8230; you&#8217;ve reached the end &#8230; hope you have a good time practising your mathematics knowledge of Fractions (there is also post-answer advice (different to optional double click  (on iOS we say &#8220;use any gesture&#8221;) pre-answer advice), if you want to learn &#8230; you can get it when you give an incorrect answer)!   Try the double clicking canvas functionality  (on iOS we say &#8220;use any gesture&#8221;), as well, if you like.  We&#8217;ll take this a step further, visually, on <a target=_blank title='Step further' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?m=20140511'>11\/05\/2014<\/a>.<\/p>\n<hr \/>\n<p id='hjcfgt'>Previous <a target=_blank title='HTML\/Javascript Canvas Fractions Game Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=7258'>HTML\/Javascript Canvas Fractions Game Tutorial<\/a> of interest is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/fraction_chalkboard.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"HTML\/Javascript Canvas Chalkboard Game Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/fraction_chalkboard.jpg\" title=\"HTML\/Javascript Canvas Fractions Game Tutorial\"  \/><\/a><p class=\"wp-caption-text\">HTML\/Javascript Canvas Fractions Game Tutorial<\/p><\/div>\n<p>The Canvas HTML element tag can be used as the container to draw graphics on the fly usually via the use of Javascript functions for rendering and event management.<\/p>\n<p>In today&#8217;s tutorial we touch on the functionality to draw an image on the canvas via drawImage() method.   In the case of this tutorial that image contributes to the user answering some mathematics questions regarding fractions on a simulated <i>&#8220;chalkboard&#8221;<\/i>.<\/p>\n<p>You may want to read more at <a target=_blank title='HTML Canvas Reference' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>HTML Canvas Reference<\/a> as a generic reference, or here, at the tutorial <a target=_blank title='javascript - How do I add a simple onClick event handler to a canvas element? - Stack Overflow' href='http:\/\/stackoverflow.com\/questions\/9880279\/how-do-i-add-a-simple-onclick-event-handler-to-a-canvas-element'>javascript &#8211; How do I add a simple onClick event handler to a canvas element? &#8211; Stack Overflow<\/a>.<\/p>\n<p>As you can imagine, this HTML canvas element, new to HTML5, can be very useful for some practical client-side web functionality.<\/p>\n<p>Link to some downloadable HTML programming code &#8230; rename to <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/fraction_chalkboard.html_GETME' title='fraction_chalkboard.html'>fraction_chalkboard.html<\/a>\n<\/p>\n<p>You&#8217;ll notice heavy use of the Javascript <a target=_blank title='Javascript Math.random() information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/jsref_random.asp'>Math.random()<\/a> function.<\/p>\n<p>We hope you enjoy this tutorial as a <a target=_blank title='Canvas HTML element live run tutorial'  href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Canvas\/Game\/Chalkboard\/fraction_chalkboard.html\">live run<\/a>.<\/p>\n<p>Yes &#8230; you&#8217;ve reached the end &#8230; hope you have a good time practising your mathematics knowledge of fractions (there is advice, if you want to learn &#8230; you can get it when you give an incorrect answer)!<\/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='#d7258' onclick='var dv=document.getElementById(\"d7258\"); 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='d7258' 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='#d7591' onclick='var dv=document.getElementById(\"d7591\"); 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='d7591' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Canvas HTML element tag can be used as the container to draw graphics on the fly usually via the use of Javascript functions for rendering and event management. In today&#8217;s tutorial we add to the functionality of the previous &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/htmljavascript-canvas-double-click-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,15,17,37],"tags":[184,281,359,401,402,459,485,576,626,652,752,997,1319],"class_list":["post-7591","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-games","category-gui","category-tutorials","tag-canvas","tag-css","tag-double-click","tag-event-driven","tag-events","tag-fractions","tag-gesture","tag-html","tag-ios","tag-javascript","tag-mathematics","tag-programming","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/7591"}],"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=7591"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/7591\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=7591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=7591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=7591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}