/dev/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/dev/trunk

« back to all changes in this revision

Viewing changes to js/window.js

  • Committer: Suren A. Chilingaryan
  • Date: 2010-08-04 06:30:21 UTC
  • Revision ID: csa@dside.dyndns.org-20100804063021-shdx01q2pg5r3a1k
Initial commit of gestures support for iDevices by Toni Pirhonen, Fix IE support broken by revision r196

Show diffs side-by-side

added added

removed removed

Lines of Context:
390
390
        }
391
391
    }
392
392
}
 
393
/**PinchZoom 
 
394
 * Zooming x and y -axis when using Safari webkit browser on a touchdevice.
 
395
 */
 
396
WINDOW.prototype.PinchZoom = function(values) {
 
397
 
 
398
  if(values.device == "iPhone")
 
399
  {
 
400
    var scale_min = 0.34;
 
401
    var scale_max = 3.5;
 
402
  }
 
403
  if(values.device == "iPad"){
 
404
     var scale_min = 0.26;
 
405
     var scale_max = 10;
 
406
  }
 
407
  if(values.device != "undefined"){
 
408
 
 
409
    if(values.scale > scale_max){ values.scale = scale_max;}
 
410
 
 
411
    if(values.startX > values.marginsLeft) {  
 
412
         var xmin = this.graph.xmin;
 
413
         var xmax = this.graph.xmax;
 
414
         var xzoomedmin =  values.startX;
 
415
         if(values.scale > 1){
 
416
            var xzoomedmax = adeiMathPreciseAdd(xzoomedmin,(xmax-xzoomedmin)/scale_max*(values.scale));
 
417
            this.SetCustomWindow(xzoomedmin,xzoomedmax);
 
418
          }
 
419
          if(values.scale < 1){
 
420
            this.CenterZoomOut();
 
421
          }
 
422
      }
 
423
      else
 
424
      {
 
425
        if(values.scale < 1)
 
426
        {
 
427
          for(var i = 0; i < values.y.length; i++){
 
428
            this.YZoomOut(i, values.y[i]);
 
429
          }
 
430
        }
 
431
        else if ( values.scale > 1){
 
432
          for(var i = 0; i < values.y.length; i++){
 
433
            this.YZoomIn(i, values.y[i]);
 
434
          }
 
435
        }
 
436
 
 
437
 
 
438
      values = null;
 
439
      
 
440
    }
 
441
  }
 
442
  else{alert("Unknown touchdevice");}
 
443
}
 
444
 
 
445
/**Swipe
 
446
 * Moves graph axis a step to swiped direction
 
447
 */
 
448
WINDOW.prototype.Swipe = function(direction){
 
449
   switch(direction){
 
450
     case 1: //Swipeleft
 
451
      this.MoveRight();
 
452
      break;
 
453
     case 2: //Swiperight
 
454
      this.MoveLeft();
 
455
      break;
 
456
     case 3: //Swipeup
 
457
      this.MoveDown();
 
458
      break;
 
459
     case 4: //Swipedown
 
460
      this.MoveUp();
 
461
      break;
 
462
   
 
463
   }
 
464
}
393
465
 
394
466
WINDOW.prototype.Lock = function() {
395
467
    if ((this.graph)&&(this.cfg.width >= 0)) {