73
/** Checks if user is running on iPhone/iPod or iPad
74
* if running on safari with iPhone returns "iPhone" if with iPad returns "iPad"
76
GRAPH.prototype.getDevice = function() {
77
if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
81
else if (navigator.userAgent.match(/iPad/i))
86
return "other than iPad iPod iPhone";
92
73
GRAPH.prototype.onImageLoad = function(self) {
93
74
return function() {
94
75
adei.SetSuccessStatus(self.onload_message?self.onload_message:translate("Done"));
96
self.AnimatorEffects(self,2);
78
self.AnimatorEffects(self,2);
579
561
// alert(direction);
580
562
if(direction != 0)
564
if(self.fader != 0) {
583
565
self.AnimatorEffects(self,1);}
584
self.window.Swipe(direction);
566
self.window.Swipe(direction);
585
567
//alert(direction);
586
568
//self.window.Apply();
587
569
//startValuesSet = 0;
590
572
else if(self.onlyLegend === 1 && self.swiping === 0){
573
var iphone = isiPhone();
591
575
var x = adeiMathPreciseAdd(self.xmin, self.xsize*(self.startX - self.margins.left) / self.real_width);
592
576
var y = new Array();
593
577
for (var i = 0; i < self.axis.length; i++) {
594
578
y[i] = self.ymax[i] - (self.ymax[i] - self.ymin[i])*(self.startY - self.margins.top) / self.real_height;
598
582
xmin: self.xmin.toString(),
599
583
xmax: self.xmax.toString(),
653
636
gestureValues.x = adeiMathPreciseAdd(self.xmin, self.xsize*(self.startX - self.margins.left) / self.real_width);
654
637
// alert(self.margins.left);
655
638
gestureValues.marginsLeft = self.margins.left;
656
gestureValues.device = self.device;
639
gestureValues.device = self.idevice;
657
640
gestureValues.y = new Array();
658
641
for (var i = 0; i < self.axis.length; i++) {
659
642
gestureValues.y[i] = self.ymax[i] - (self.ymax[i] - self.ymin[i])*(self.startY - self.margins.top) / self.real_height;
661
644
if(self.fader != 0){self.AnimatorEffects(self,1);}
645
gestureValues.scale = scale;
662
646
gestureValues.startX = self.startX;
663
gestureValues.angle = angle;
664
gestureValues.scale = scale;
665
647
self.window.PinchZoom(gestureValues);
666
648
self.startValuesSet = 0;
672
653
GRAPH.prototype.onOrientationChange = function(self){
673
654
return function(e){
674
self.updateOrientation();
680
GRAPH.prototype.updateOrientation = function(self){
681
switch(window.orientation){
682
case 0: //normal portrait
685
case -90: //right landscape
688
case 90: //left landscape
691
case 180: //Upsidedown portrait
655
if(self.fader != 0){self.AnimatorEffects(self,1);}
700
661
/**Gets direction of Swipe gesture
701
662
* When user swipes the screen with 1 finger, calculates heading and return an integer.
812
779
var new_height = this.img.height;
816
if ((new_width != this.width)||(new_height != this.height)) {
782
if ((new_width != this.width)||(new_height != this.height)) {
817
783
this.width = new_width;
818
784
this.height = new_height;
819
785
this.crop.setParams(); // DS. this action slows evertything down after several steps
824
790
tooltip = " (" + this.exporter.GetTooltip() + ")";
828
if(this.device == "iPhone" || this.device == "iPad")
830
this.crop = new Cropper.Img("graph_image", {
831
/* onEndCrop: this.onEndCrop(this),
832
onCancelCrop: this.onCancelCrop(this),
833
onClick: this.onClick(this),
834
onDblClick: this.onDblClick(this),
835
onDblSelClick: this.onApply(this),
836
onMouseScroll: this.onMouseScroll(this),
837
onMouseMove: this.onMouseMove(this),
839
//onOrientationChange: this.onOrientationChange(this),
840
onTouchStart: this.onTouchStart(this),
841
onTouchMove:this.onTouchMove(this),
842
onTouchEnd:this.onTouchEnd(this),
843
onGestureStart:this.onGestureStart(this),
844
onGestureMove:this.onGestureMove(this),
845
onGestureEnd:this.onGestureEnd(this),
846
onApplyClick: this.onApply(this),
847
onSaveClick: this.onSave(this),
848
extraButtons: this.extraButtons,
849
margins: this.crop_margins,
850
allWidth: this.allWidth,
851
allHeight: this.allHeight,
855
tooltips: new Object({
856
'apply': translate('Zoom to the Selection'),
857
'save': translate('Export Selected Data') + tooltip
861
this.width = new_width;
862
this.height = new_height;
795
this.crop = new Cropper.Img("graph_image", {
796
onOrientationChange: this.onOrientationChange(this),
797
onTouchStart: this.onTouchStart(this),
798
onTouchMove:this.onTouchMove(this),
799
onTouchEnd:this.onTouchEnd(this),
800
onGestureStart:this.onGestureStart(this),
801
onGestureMove:this.onGestureMove(this),
802
onGestureEnd:this.onGestureEnd(this),
803
onApplyClick: this.onApply(this),
804
onSaveClick: this.onSave(this),
805
extraButtons: this.extraButtons,
806
margins: this.crop_margins,
807
allWidth: this.allWidth,
808
allHeight: this.allHeight,
813
this.width = new_width;
814
this.height = new_height;
866
816
this.crop = new Cropper.Img("graph_image", {
867
817
onEndCrop: this.onEndCrop(this),
868
818
onCancelCrop: this.onCancelCrop(this),