No, son solo pruebas que le he estado haciendo para probar el codigo
Lo coloco nuevamente en como lo tengo (que no es mucho cambio)
Código Javascript
:
Ver original<script>
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>';
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: {
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";
};
</script>
De esta manera, al pasar el cursor solo me escribe baja