Quantcast
Channel: simonsarris - Latest Comments
Viewing all articles
Browse latest Browse all 193

Re: A Gentle Introduction to Making HTML5 Canvas Interactive

$
0
0

I really enjoyed your post; it was a great way to present the canvas. I have one suggestion. About half way down function myMove(e) (line 296 or so) a loop is created to iterate through the selection handles. Inside that loop is a switch statement determining the current selection handle and setting the cursor value.. Since the current selection handle is already known (from the loop index) and the cursor values are hard coded, why not just create an array of cursor styles (i.e. var cursorStyle = new Array("nw-resize", "n-resize", "ne-resize",...) outside the loop and inside the loop below the "invalidate()" command do this: this.style.cursor = cursorStyle[i]; Then delete that entire switch command.


Viewing all articles
Browse latest Browse all 193

Trending Articles