I am referring jsfiddle for reference. In this blue arch is reducing with knob but other arch are not working with knob. Can any one please suggest any reference for this.
[Canvas][1]
[1]: http://jsfiddle.net/matthias_h/L5auuagc/enter code here
I am referring jsfiddle for reference. In this blue arch is reducing with knob but other arch are not working with knob. Can any one please suggest any reference for this.
[Canvas][1]
[1]: http://jsfiddle.net/matthias_h/L5auuagc/enter code here
As i mentioned in the comment, this is a stacking problem. Since knob uses canvas, all thee canvases are stacked up with
position: absolute
. So always the top one receives all the events.What you can do is get the mouse position when the mouse moves on any of the canvas and get the color of all the canvases on that particular position. If the color is transparent/no color then push the canvas down in the stack by setting a negative
z-index
. If it has some color then push it up in the stack by setting a positivez-index
.Here is a code sample:
HTML
JS
To get the exact mouse position, find the position of the canvas element on the document using the following function:
Here is the fiddle for you:
http://jsfiddle.net/k7moorthi/n8nnpyw6/5/
CREDITS:
lwburk for exact element position on document and color of a particular point in canvas code snippets.