I m using the jQuery Map Hilighter plugin, but instead of fading a dark patch over each area, I would like to reverse this and instead make the surrounding area dark, keeping the hovered area the same colour.
I ve looked at the code for the plugin and it appears to use the canvas element (and an MS equivalent I guess) to do the highlighting. However, Firebug isn t very forthcoming with exactly where the shapes are defined - on the demo above it just shows this:
<canvas style="border: 0pt none ; padding: 0pt; width: 960px; height: 593px; position: absolute; left: 0pt; top: 0pt; opacity: 1;" height="593" width="960"></canvas>
And I can t see anything that specifies an element shape to hover. This is the part of the JS that appears to be creating the shape:
add_shape_to = function(canvas, shape, coords, options) {
var i, context = canvas.getContext( 2d );
context.beginPath();
if(shape == rect ) {
context.rect(coords[0], coords[1], coords[2] - coords[0], coords[3] - coords[1]);
} else if(shape == poly ) {
context.moveTo(coords[0], coords[1]);
for(i=2; i < coords.length; i+=2) {
context.lineTo(coords[i], coords[i+1]);
}
} else if(shape == circ ) {
context.arc(coords[0], coords[1], coords[2], 0, Math.PI * 2, false);
}
context.closePath();
if(options.fill) {
context.fillStyle = css3color(options.fillColor, options.fillOpacity);
context.fill();
}
if(options.stroke) {
context.strokeStyle = css3color(options.strokeColor, options.strokeOpacity);
context.lineWidth = options.strokeWidth;
context.stroke();
}
if(options.fade) {
fader(canvas, 0);
}
};