Gracias por el Interes
Aqui les va el codigo completo de la página
Código HTML:
Ver original<!DOCTYPE HTML>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> body {
margin: 0px;
padding: 0px;
font-family: Calibri;
}
canvas {
border: 1px solid #9C9898;
}
#page {
position: relative;
width: 800px;
height: 450px;
}
#controls {
position: absolute;
right: 10px;
top: 10px;
z-index: 99999;
}
label {
color: white;
vertical-align: top;
}
<script src="kinetic-v3.5.2.js"> function writeMessage(context, message){
context.fillStyle = "white";
context.fillRect(500, 20, 450, 200);
context.font = "20pt Calibri";
context.fillStyle = "blue";
context.fillText(message, 500, 80);
}
window.onload = function(){
var stage = new Kinetic.Stage("container", 900, 500);
var canvas = stage.getCanvas();
var stageContext = stage.getContext();
var showImageMap = false;
var baja = "Baja California '
<br>' zzzz";
var planets = {
"SUCURSAL TIJUANA, B.C.": {
x: 35,
y: 35,
radius: 11,
},
"SUCURSAL MEXICALI, B.C.": {
x: 179,
y: 126,
radius: 6
},
"OFICINA LA PAZ, B.C.": {
x: 366,
y: 127,
radius: 6
},
"SUCURSAL HERMOSILLO, SON": {
x: 515,
y: 127,
radius: 6
},
"Baja CaliforniaTel. 123": {
x: 200,
y: 100,
radius: 6
}
};
var imageObj = new Image();
imageObj.onload = function(){
// draw planets
stageContext.drawImage(imageObj, 0, 0, canvas.width, canvas.height);
// draw shape overlays
for (var pubKey in planets) {
(function(){
var key = pubKey;
var planet = planets[key];
var planetOverlay = new Kinetic.Shape(function(){
var context = this.getContext();
context.beginPath();
context.arc(planet.x, planet.y, planet.radius, 0, Math.PI * 2, false);
context.closePath();
if (this.fill) {
context.fillStyle = "red";
context.fill();
}
});
planetOverlay.on("mouseover", function(){
writeMessage(stageContext, key);
});
planetOverlay.on("mouseout", function(){
writeMessage(stageContext, "");
});
planetOverlay.fill = false;
stage.add(planetOverlay);
}());
}
var checkbox = document.getElementById("checkbox");
checkbox.addEventListener("click", function(){
showImageMap = !showImageMap;
var shapes = stage.getShapes();
// reset fill property
for (var n = 0; n < shapes.length; n++) {
var shape = shapes[n];
shape.fill = showImageMap;
}
stage.draw();
}, false);
};
imageObj.src = "images/mapasucyof.png";
};
<body onmousedown="return false;"> <div id="container" class="back"></div> <input type="checkbox" id="checkbox"> Show map overlay
El código de kinetic lo descargue de la siguiente liga:
http://www.html5canvastutorials.com/...etic-v3.6.0.js
Y el ejemplo original es el siguiente:
http://www.html5canvastutorials.com/.../#comment-3113
Gracias