Ver Mensaje Individual
  #10 (permalink)  
Antiguo 19/01/2012, 13:44
Avatar de Yedi
Yedi
 
Fecha de Ingreso: junio-2006
Ubicación: México
Mensajes: 159
Antigüedad: 17 años, 10 meses
Puntos: 2
Respuesta: Salto de linea en un texto?

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
  1. <script>
  2.             function writeMessage(context, message){
  3.                 context.fillStyle = "white";
  4.                 context.fillRect(500, 20, 450, 200);
  5.                 context.font = "20pt Calibri";
  6.                 context.fillStyle = "blue";
  7.                 context.fillText(message, 500, 80);
  8.             }
  9.            
  10.             window.onload = function(){
  11.                 var stage = new Kinetic.Stage("container", 900, 500);
  12.                 var canvas = stage.getCanvas();
  13.                 var stageContext = stage.getContext();
  14.                 var showImageMap = false;
  15.                
  16.         var baja = 'Baja California <br>';
  17.                              
  18.                 var planets = {
  19.                     "SUCURSAL TIJUANA, B.C.": {
  20.                         x: 35,
  21.                         y: 35,
  22.                         radius: 11,
  23.                
  24.                     },
  25.                    "SUCURSAL MEXICALI, B.C.": {
  26.                         x: 179,
  27.                         y: 126,
  28.                         radius: 6
  29.                     },
  30.                     "OFICINA LA PAZ, B.C.": {
  31.                         x: 366,
  32.                         y: 127,
  33.                         radius: 6
  34.                     },
  35.                     "SUCURSAL HERMOSILLO, SON": {
  36.                         x: 515,
  37.                         y: 127,
  38.                         radius: 6
  39.                     },
  40.              baja: {
  41.                         x: 200,
  42.                         y: 100,
  43.                         radius: 6
  44.                     }
  45.                 };
  46.                
  47.                 var imageObj = new Image();
  48.                 imageObj.onload = function(){
  49.                     // draw planets
  50.                     stageContext.drawImage(imageObj, 0, 0, canvas.width, canvas.height);
  51.                    
  52.                     // draw shape overlays
  53.                     for (var pubKey in planets) {
  54.                         (function(){
  55.                             var key = pubKey;
  56.                             var planet = planets[key];
  57.                            
  58.                             var planetOverlay = new Kinetic.Shape(function(){
  59.                                 var context = this.getContext();
  60.                                 context.beginPath();
  61.                                 context.arc(planet.x, planet.y, planet.radius, 0, Math.PI * 2, false);
  62.                                 context.closePath();
  63.                                
  64.                                 if (this.fill) {
  65.                                     context.fillStyle = "red";
  66.                                     context.fill();
  67.                                 }
  68.                             });
  69.                            
  70.                             planetOverlay.on("mouseover", function(){
  71.                                 writeMessage(stageContext, key);
  72.                             });
  73.                             planetOverlay.on("mouseout", function(){
  74.                                 writeMessage(stageContext, "");
  75.                             });
  76.                            
  77.                                                        
  78.                              planetOverlay.fill = false;
  79.                             stage.add(planetOverlay);
  80.                         }());
  81.                     }
  82.                    
  83.                     var checkbox = document.getElementById("checkbox");
  84.                     checkbox.addEventListener("click", function(){
  85.                         showImageMap = !showImageMap;
  86.                         var shapes = stage.getShapes();
  87.                        
  88.                         // reset fill property
  89.                         for (var n = 0; n < shapes.length; n++) {
  90.                             var shape = shapes[n];
  91.                             shape.fill = showImageMap;
  92.                         }
  93.                        
  94.                         stage.draw();
  95.                     }, false);
  96.                    
  97.                 };
  98.                 imageObj.src = "images/mapasucyof.png";
  99.             };
  100.         </script>

De esta manera, al pasar el cursor solo me escribe baja