|
@@ -15,6 +15,8 @@ import org.openzen.drawablegui.DFontMetrics;
|
15
|
15
|
import org.openzen.drawablegui.DIRectangle;
|
16
|
16
|
import org.openzen.drawablegui.DMouseEvent;
|
17
|
17
|
import org.openzen.drawablegui.DTimerHandle;
|
|
18
|
+import org.openzen.drawablegui.DTooltip;
|
|
19
|
+import org.openzen.drawablegui.DTooltipHandle;
|
18
|
20
|
import org.openzen.drawablegui.listeners.ListenerHandle;
|
19
|
21
|
import org.openzen.drawablegui.live.LiveInt;
|
20
|
22
|
import org.openzen.drawablegui.live.LiveObject;
|
|
@@ -231,12 +233,28 @@ public class DScrollPane implements DComponent {
|
231
|
233
|
private DMouseEvent translateMouseEvent(DMouseEvent e) {
|
232
|
234
|
return new DMouseEvent(
|
233
|
235
|
e.window,
|
234
|
|
- e.x - bounds.x + offsetX.getValue(),
|
235
|
|
- e.y - bounds.y + offsetY.getValue(),
|
|
236
|
+ toLocalX(e.x),
|
|
237
|
+ toLocalY(e.y),
|
236
|
238
|
e.modifiers,
|
237
|
239
|
e.deltaZ,
|
238
|
240
|
e.clickCount);
|
239
|
241
|
}
|
|
242
|
+
|
|
243
|
+ private int toGlobalX(int x) {
|
|
244
|
+ return x + bounds.x - offsetX.getValue();
|
|
245
|
+ }
|
|
246
|
+
|
|
247
|
+ private int toGlobalY(int y) {
|
|
248
|
+ return y + bounds.y - offsetY.getValue();
|
|
249
|
+ }
|
|
250
|
+
|
|
251
|
+ private int toLocalX(int x) {
|
|
252
|
+ return x - bounds.x + offsetX.getValue();
|
|
253
|
+ }
|
|
254
|
+
|
|
255
|
+ private int toLocalY(int y) {
|
|
256
|
+ return y - bounds.y + offsetY.getValue();
|
|
257
|
+ }
|
240
|
258
|
|
241
|
259
|
private class TranslatedContext implements DUIContext {
|
242
|
260
|
|
|
@@ -257,8 +275,8 @@ public class DScrollPane implements DComponent {
|
257
|
275
|
|
258
|
276
|
@Override
|
259
|
277
|
public void repaint(int x, int y, int width, int height) {
|
260
|
|
- int left = x + bounds.x - offsetX.getValue();
|
261
|
|
- int top = y + bounds.y - offsetY.getValue();
|
|
278
|
+ int left = toGlobalX(x);
|
|
279
|
+ int top = toGlobalY(y);
|
262
|
280
|
int right = left + width;
|
263
|
281
|
int bottom = top + height;
|
264
|
282
|
|
|
@@ -308,12 +326,17 @@ public class DScrollPane implements DComponent {
|
308
|
326
|
|
309
|
327
|
@Override
|
310
|
328
|
public DUIWindow openDialog(int x, int y, DAnchor anchor, String title, DComponent root) {
|
311
|
|
- return context.openDialog(x, y, anchor, title, root);
|
|
329
|
+ return context.openDialog(toGlobalX(x), toGlobalY(y), anchor, title, root);
|
312
|
330
|
}
|
313
|
331
|
|
314
|
332
|
@Override
|
315
|
333
|
public DUIWindow openView(int x, int y, DAnchor anchor, DComponent root) {
|
316
|
|
- return context.openView(x, y, anchor, root);
|
|
334
|
+ return context.openView(toGlobalX(x), toGlobalY(y), anchor, root);
|
|
335
|
+ }
|
|
336
|
+
|
|
337
|
+ @Override
|
|
338
|
+ public DTooltipHandle openTooltip(int x, int y, DTooltip tooltip) {
|
|
339
|
+ return context.openTooltip(toGlobalX(x), toGlobalY(y), tooltip);
|
317
|
340
|
}
|
318
|
341
|
}
|
319
|
342
|
|