+/**
+ * Perform a mouse action.
+ */
+bool
+FGPanel::doMouseAction (int button, int updown, int x, int y)
+{
+ // FIXME: this same code appears in update()
+ int xsize = _xsize_node->getIntValue();
+ int ysize = _ysize_node->getIntValue();
+ float aspect_adjust = get_aspect_adjust(xsize, ysize);
+
+ // Scale for the real window size.
+ if (aspect_adjust < 1.0) {
+ x = int(((float)x / xsize) * WIN_W * aspect_adjust);
+ y = int(WIN_H - ((float(y) / ysize) * WIN_H));
+ } else {
+ x = int(((float)x / xsize) * WIN_W);
+ y = int((WIN_H - ((float(y) / ysize) * WIN_H)) / aspect_adjust);
+ }
+
+ // Adjust for offsets.
+ x -= _x_offset->getIntValue();
+ y -= _y_offset->getIntValue();
+
+ // Having fixed up the coordinates, fall through to the local
+ // coordinate handler.
+ return doLocalMouseAction(button, updown, x, y);
+}
+