Lines 80-93
Link Here
|
80 |
port.getClientArea(rect); |
80 |
port.getClientArea(rect); |
81 |
port.translateToParent(rect); |
81 |
port.translateToParent(rect); |
82 |
port.translateToAbsolute(rect); |
82 |
port.translateToAbsolute(rect); |
83 |
return rect.contains(where) && !rect.crop(threshold).contains(where); |
83 |
return shouldScroll(rect, where); |
84 |
} |
84 |
} |
85 |
|
85 |
|
86 |
/** |
86 |
/** |
87 |
* Returns <code>true</code> if the given point is outside the viewport or near its edge. |
87 |
* Returns <code>true</code> if the given point is near the viewport's edge. |
88 |
* Scrolls the viewport by a calculated (time based) amount in the current direction. |
88 |
* Scrolls the viewport by a calculated (time based) amount in the current |
|
|
89 |
* direction. |
89 |
* |
90 |
* |
90 |
* todo: investigate if we should allow auto expose when the pointer is outside the viewport |
91 |
* todo: investigate if we should allow auto expose when the pointer is outside |
|
|
92 |
* the viewport -- this is commented on in bugzilla 44288 |
91 |
* |
93 |
* |
92 |
* @see org.eclipse.gef.AutoexposeHelper#step(org.eclipse.draw2d.geometry.Point) |
94 |
* @see org.eclipse.gef.AutoexposeHelper#step(org.eclipse.draw2d.geometry.Point) |
93 |
*/ |
95 |
*/ |
Lines 98-106
Link Here
|
98 |
port.getClientArea(rect); |
100 |
port.getClientArea(rect); |
99 |
port.translateToParent(rect); |
101 |
port.translateToParent(rect); |
100 |
port.translateToAbsolute(rect); |
102 |
port.translateToAbsolute(rect); |
101 |
if (!rect.contains(where) |
103 |
if (!shouldScroll(rect, where)) { |
102 |
|| rect.crop(threshold).contains(where)) |
104 |
return false; |
103 |
return false; |
105 |
} |
104 |
|
106 |
|
105 |
// set scroll offset (speed factor) |
107 |
// set scroll offset (speed factor) |
106 |
int scrollOffset = 0; |
108 |
int scrollOffset = 0; |
Lines 145-148
Link Here
|
145 |
return "ViewportAutoexposeHelper for: " + owner; //$NON-NLS-1$ |
147 |
return "ViewportAutoexposeHelper for: " + owner; //$NON-NLS-1$ |
146 |
} |
148 |
} |
147 |
|
149 |
|
|
|
150 |
/** |
151 |
* Returns true if the point is inside the area where auto-scrolling should |
152 |
* occur; false otherwise. |
153 |
* |
154 |
* @param rect |
155 |
* the viewport's client area, translated to absolute coordinates |
156 |
* @param where |
157 |
* the point in question |
158 |
* @return true if the point is inside the area where auto-scrolling should |
159 |
* occur; false otherwise. |
160 |
* @since 3.3 |
161 |
*/ |
162 |
protected boolean shouldScroll(Rectangle rect, Point where) { |
163 |
return rect.contains(where) && !rect.crop(threshold).contains(where); |
164 |
} |
165 |
|
166 |
/** |
167 |
* Gets the threshold which is the insets that define where the auto-scrolling |
168 |
* behavior should kick in. |
169 |
* |
170 |
* @return Returns the threshold. |
171 |
* @since 3.3 |
172 |
*/ |
173 |
protected Insets getThreshold() { |
174 |
return threshold; |
175 |
} |
176 |
|
148 |
} |
177 |
} |