View | Details | Raw Unified | Return to bug 168582 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/gef/tools/TargetingTool.java (-4 / +13 lines)
Lines 88-96 Link Here
88
 * than the time required to perform the step().
88
 * than the time required to perform the step().
89
 */
89
 */
90
protected void doAutoexpose() {
90
protected void doAutoexpose() {
91
	if (exposeHelper == null)
91
	if (getAutoexposeHelper() == null)
92
		return;
92
		return;
93
	if (exposeHelper.step(getLocation())) {
93
	if (getAutoexposeHelper().step(getLocation())) {
94
		handleAutoexpose();
94
		handleAutoexpose();
95
		Display.getCurrent().asyncExec(new QueuedAutoexpose());
95
		Display.getCurrent().asyncExec(new QueuedAutoexpose());
96
	} else
96
	} else
Lines 289-295 Link Here
289
289
290
class QueuedAutoexpose implements Runnable {
290
class QueuedAutoexpose implements Runnable {
291
	public void run() {
291
	public void run() {
292
		if (exposeHelper != null)
292
		if (getAutoexposeHelper() != null)
293
			doAutoexpose();
293
			doAutoexpose();
294
	}
294
	}
295
}
295
}
Lines 309-314 Link Here
309
}
309
}
310
310
311
/**
311
/**
312
 * Gets the autoexpose helper.
313
 * @return the autoexpose helper
314
 * @since 3.3
315
 */
316
protected AutoexposeHelper getAutoexposeHelper() {
317
    return exposeHelper;
318
}
319
320
/**
312
 * Sets the target editpart.  If the target editpart is changing, this method will call
321
 * Sets the target editpart.  If the target editpart is changing, this method will call
313
 * {@link #handleExitingEditPart()} for the previous target if not <code>null</code>, and
322
 * {@link #handleExitingEditPart()} for the previous target if not <code>null</code>, and
314
 * {@link #handleEnteredEditPart()} for the new target, if not <code>null</code>.
323
 * {@link #handleEnteredEditPart()} for the new target, if not <code>null</code>.
Lines 358-364 Link Here
358
 * mouse location and calls {@link #setAutoexposeHelper(AutoexposeHelper)}.
367
 * mouse location and calls {@link #setAutoexposeHelper(AutoexposeHelper)}.
359
 */
368
 */
360
protected void updateAutoexposeHelper() {
369
protected void updateAutoexposeHelper() {
361
	if (exposeHelper != null)
370
	if (getAutoexposeHelper() != null)
362
		return;
371
		return;
363
	AutoexposeHelper.Search search;
372
	AutoexposeHelper.Search search;
364
	search = new AutoexposeHelper.Search(getLocation());
373
	search = new AutoexposeHelper.Search(getLocation());
(-)src/org/eclipse/gef/editparts/ViewportAutoexposeHelper.java (-7 / +36 lines)
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
}

Return to bug 168582