source: drbl_ui/flow_chart/login_switch_flow_chart.files/vml_1.js @ 65

Last change on this file since 65 was 21, checked in by chris, 16 years ago
File size: 5.1 KB
Line 
1
2function ViewMgrSetVMLLocation(pageID, shapeID, pinX, pinY)
3{
4  doc = parent.frmDrawing.document;
5  if (this.highlightDiv != null)
6  {
7    clickMenu ();
8
9    var VMLImage = this.s;
10
11    var imageLeft = 0;
12    var imageRight = imageLeft + VMLImage.pixelWidth;
13    var imageTop = 0;
14    var imageBottom = imageTop + VMLImage.pixelHeight;
15
16    var xLong = parent.ConvertXorYCoordinate(pinX, this.visBBoxLeft, this.visBBoxRight, imageLeft, imageRight, 0);
17    var yLong = parent.ConvertXorYCoordinate(pinY, this.visBBoxBottom, this.visBBoxTop, imageTop, imageBottom, 1);
18
19    xLong += doc.all['ConvertedImage'].style.posLeft;
20    yLong += doc.all['ConvertedImage'].style.posTop;
21
22    var arrowHalfWidth = viewMgr.highlightDiv.clientWidth / 2;
23    var arrowHeight = viewMgr.highlightDiv.clientHeight;
24
25    var boolNeedToScroll = false;
26
27    if( !( (xLong - arrowHalfWidth) > doc.body.scrollLeft && (xLong + arrowHalfWidth) < (doc.body.scrollLeft + doc.body.clientWidth) ))
28    {
29      boolNeedToScroll = true;
30    }
31   
32    if( !( (yLong - arrowHeight) > doc.body.scrollTop && (yLong + arrowHeight) < (doc.body.scrollTop + doc.body.clientHeight) ))
33    {
34      boolNeedToScroll = true;
35    }
36   
37    if( boolNeedToScroll == true )
38    {
39      window.scrollTo( xLong - doc.body.clientWidth / 2, yLong - doc.body.clientHeight / 2);
40    }
41   
42    this.highlightDiv.style.posLeft = xLong - arrowHalfWidth;
43    this.highlightDiv.style.posTop = yLong;
44    this.highlightDiv.style.visibility = "visible";
45
46    setTimeout( "parent.hideObject(viewMgr.highlightDiv)", 0 );
47    setTimeout( "parent.showObject(viewMgr.highlightDiv)", 1 );
48    setTimeout( "parent.hideObject(viewMgr.highlightDiv)", 2500 );
49  }
50}
51
52function VMLZoomChange(size)
53{
54  if(size)
55  {
56    if(size == "up")
57    {
58      size = zoomLast + 50;
59    }
60    else if(size == "down")
61    {
62      size = zoomLast - 50;
63    }
64   
65    size = parseInt(size);
66    if(typeof(size) != "number")
67      size = 100;
68  }
69  else
70  {
71    size = 100;
72  }
73
74  clickMenu ();
75
76  viewMgr.zoomLast = size;
77
78  var zoomFactor = size/100;
79
80  var width = this.s.pixelWidth;
81  var height = this.s.pixelHeight;
82
83  var margin = parseInt(document.body.style.margin) * 2;
84
85  var clientWidth = document.body.clientWidth;
86  var clientHeight = document.body.clientHeight;
87
88  var newScrollLeft = document.body.scrollLeft;
89  var newScrollTop = document.body.scrollTop;
90
91  var winwidth = clientWidth - margin;
92  var winheight = clientHeight - margin;
93
94  var widthRatio = winwidth / width;
95  var heightRatio = winheight / height;
96
97  if (widthRatio < heightRatio)
98  {
99    width = zoomFactor * winwidth;
100    height = width / this.origWH;
101  }
102  else
103  {
104    height = zoomFactor * winheight;
105    width = height * this.origWH;
106  }
107
108  this.s.pixelWidth = Math.max(width,1);
109  this.s.pixelHeight = Math.max(height,1);
110
111  this.sizeLast = size;
112
113  var centerX = (zoomFactor / viewMgr.zoomFactor) * (newScrollLeft + (clientWidth / 2) - this.s.posLeft);
114  var centerY = (zoomFactor / viewMgr.zoomFactor) * (newScrollTop + (clientHeight / 2) - this.s.posTop);
115
116  viewMgr.zoomFactor = zoomFactor;
117
118  if (width <= clientWidth)
119  {
120    this.s.posLeft = Math.max( 0, (clientWidth / 2) - (width / 2));
121  }
122  else
123  {
124    var left = centerX - (clientWidth / 2);
125    if ( left >= 0 )
126    {
127      this.s.posLeft = 0;
128      newScrollLeft = left;
129    }
130    else
131    {
132      this.s.posLeft = -left;
133      newScrollLeft = 0;
134    }
135  }
136
137  if (height <= clientHeight)
138  {
139    this.s.posTop = Math.max( 0, (clientHeight / 2) - (height / 2));
140  }
141  else
142  {
143    var top = centerY - (clientHeight / 2);
144    if ( top >= 0 )
145    {
146      this.s.posTop = 0;
147      newScrollTop = top;
148    }
149    else
150    {
151      this.s.posTop = -top;
152      newScrollTop = 0;
153    }
154  }
155
156  window.scrollTo(newScrollLeft, newScrollTop);
157
158  this.s.visibility = "visible";
159
160  var newXOffsetPercent = document.body.scrollLeft / this.s.pixelWidth;
161  var newYOffsetPercent = document.body.scrollTop / this.s.pixelHeight;
162  var newWidthPercent = document.body.clientWidth / this.s.pixelWidth;
163  var newHeightPercent = document.body.clientHeight / this.s.pixelHeight;
164
165  if (viewMgr.viewChanged)
166  {
167    viewMgr.viewChanged (newXOffsetPercent, newYOffsetPercent, newWidthPercent, newHeightPercent);
168  }
169
170  if (viewMgr.PostZoomProcessing)
171  {
172    viewMgr.PostZoomProcessing(size);
173  }
174}
175
176function VMLSetView (xOffsetPercent, yOffsetPercent)
177{
178  var leftPixelOffset = xOffsetPercent * this.s.pixelWidth;
179  var topPixelOffset = yOffsetPercent * this.s.pixelHeight;
180
181  window.scrollTo (leftPixelOffset - this.s.posLeft, topPixelOffset - this.s.posTop);
182
183  if (viewMgr.PostSetViewProcessing)
184  {
185    viewMgr.PostSetViewProcessing();
186  }
187}
188
189function VMLOnResize ()
190{
191  if (viewMgr.zoomLast == 100)
192  {
193    viewMgr.Zoom(100);
194  }
195
196  if (viewMgr.viewChanged)
197  {
198    var image = document.all['ConvertedImage'];
199
200    var newWidthPercent = document.body.clientWidth / image.style.pixelWidth;
201    var newHeightPercent = document.body.clientHeight / image.style.pixelHeight;
202
203    viewMgr.viewChanged (null, null, newWidthPercent, newHeightPercent);
204  }
205}
206
207function VMLOnScroll ()
208{
209  if (viewMgr.viewChanged)
210  {
211    var image = document.all['ConvertedImage'];
212
213    var newXOffsetPercent = document.body.scrollLeft / image.style.pixelWidth;
214    var newYOffsetPercent = document.body.scrollTop / image.style.pixelHeight;
215
216    viewMgr.viewChanged (newXOffsetPercent, newYOffsetPercent, null, null);
217  }
218}
219
220
221
Note: See TracBrowser for help on using the repository browser.