UItoViewers.js
/* Transfers/passes mouse events done on one viewer to all other viewers.
 * Adapted from code by Kohei Ichikawa
 * @param {String} coord "Coordinates" in [x],[y] format for the view to manipulate
 * @param {Event} e The mouse event to transfer
 */
Transfers/passes mouse events done on one viewer to all other viewers.
Adapted from code by Kohei Ichikawa
@param {String} coord "Coordinates" in [x],[y] format for the view to manipulate
@param {Event} e The mouse event to transfer
Transfers / passes mouse events done on one viewer to all other viewers . Adapted from code by Kohei Ichikawa @param { String } coord " Coordinates " in [ x ] [ y ] format for the view to manipulate @param { Event } e The mouse event to transfer
function transferMouseEvent(coords, e) {
   var loopCoords;
   for(x=1; x<=$$('grid_dim').getValues().numCol; x++) {
      for(y=1; y<=$$('grid_dim').getValues().numRow; y++){
         loopCoords = x+','+y;
         if(loopCoords != coords)
         {
            var evt = $$('viewer'+x+','+y).getWindow().document.createEvent("MouseEvents");
            evt.initMouseEvent(e.type, true, true, window, e.detail, e.screenX, e.screenY,
                               e.clientX, e.clientY, e.ctrlKey, e.altKey, e.shiftKey,
                               e.metaKey, e.button, null);
            $$('viewer'+x+','+y).getWindow().$("#gldiv>canvas")[0].dispatchEvent(evt);
         }
      }
   }
}
function transferMouseEvent ( coords , e ) { var loopCoords ; for ( x = 1 ; x <= $$ ( 'grid_dim' ) . getValues ( ) . numCol ; x ++ ) { for ( y = 1 ; y <= $$ ( 'grid_dim' ) . getValues ( ) . numRow ; y ++ ) { loopCoords = x + ',' + y ; if ( loopCoords != coords ) { var evt = $$ ( 'viewer' + x + ',' + y ) . getWindow ( ) . document . createEvent ( "MouseEvents" ) ; evt . initMouseEvent ( e . type , true , true , window , e . detail , e . screenX , e . screenY , e . clientX , e . clientY , e . ctrlKey , e . altKey , e . shiftKey , e . metaKey , e . button , null ) ; $$ ( 'viewer' + x + ',' + y ) . getWindow ( ) . $ ( "#gldiv>canvas" ) [ 0 ] . dispatchEvent ( evt ) ; } } } }
Transfers/passes mouse events done on one viewer to all other viewers.
Transfers / passes mouse events done on one viewer to all other viewers .
//Loop through all viewers //If coords are not the viewer being manipulated, transfer the event