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