Skip to content

Commit daf8a2d

Browse files
committed
Fix responsive sizing of EMG Joystick widget
1 parent 84a7073 commit daf8a2d

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

OpenBCI_GUI/W_EMGJoystick.pde

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,16 @@ class W_EMGJoystick extends Widget {
111111
}
112112

113113
private void updateJoystickGraphSizeAndPosition() {
114-
//Make a unit circle constrained by the max height
115-
int _padding = 30;
116-
int distanceToUse = h > w ? w : h;
117-
polarWindowDiameter = distanceToUse - _padding*2 - EMG_PLOT_OFFSET*2 - BAR_CIRCLE_SPACER*2; //Shrink the X/Y plot so that the EMG displays fit on the outside
114+
//Make a unit circle constrained by the max height or width of the widget
115+
//Shrink the X/Y plot so that the EMG displays fit on the outside of the circle
116+
int horizontalPadding = 80;
117+
int verticalPadding = 48;
118+
if (h + verticalPadding*2 > w) {
119+
polarWindowDiameter = w - horizontalPadding*2;
120+
} else {
121+
polarWindowDiameter = h - verticalPadding*2;
122+
}
123+
118124
polarWindowHalfDiameter = polarWindowDiameter / 2;
119125
polarWindowX = x + w / 2;
120126
polarWindowY = y + h / 2;

0 commit comments

Comments
 (0)