mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 01:31:01 +00:00
Fixed positioning of wind and map orientation controls so that they
don't overlap with leaderboard handle and tab
This commit is contained in:
1 parent
1a7670d59b
commit
945ad48627
4 files changed
+54
-6
No files matched your search
@@ -94,6 +94,14 @@ table {
|
||||
padding-top: 10px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
.CombinedWindPanelParentDiv.indentsmall,
|
||||
.TrueNorthIndicatorPanelParentDiv.indentsmall {
|
||||
padding-left: 30px;
|
||||
}
|
||||
.CombinedWindPanelParentDiv.indentbig,
|
||||
.TrueNorthIndicatorPanelParentDiv.indentbig {
|
||||
padding-left: 45px;
|
||||
}
|
||||
|
||||
.MapSimulationLegendParentDiv {
|
||||
padding-bottom: 10px;
|
||||
|
||||
+23
-2
@@ -536,9 +536,8 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
RaceMap.this.add(sapLogo);
|
||||
}
|
||||
map.setControls(ControlPosition.LEFT_TOP, combinedWindPanel);
|
||||
combinedWindPanel.getParent().addStyleName("CombinedWindPanelParentDiv");
|
||||
map.setControls(ControlPosition.LEFT_TOP, trueNorthIndicatorPanel);
|
||||
trueNorthIndicatorPanel.getParent().addStyleName("TrueNorthIndicatorPanelParentDiv");
|
||||
adjustLeftControlsIndent();
|
||||
|
||||
RaceMap.this.raceMapImageManager.loadMapIcons(map);
|
||||
map.setSize("100%", "100%");
|
||||
@@ -2456,6 +2455,21 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
boolean isCompactHeader = this.getOffsetWidth() <= 600;
|
||||
getLeftHeaderPanel().setStyleName(COMPACT_HEADER_STYLE, isCompactHeader);
|
||||
getRightHeaderPanel().setStyleName(COMPACT_HEADER_STYLE, isCompactHeader);
|
||||
|
||||
// Adjust combined wind and true north indicator panel indent, based on the RaceMap height
|
||||
if (combinedWindPanel.getParent() != null && trueNorthIndicatorPanel.getParent() != null) {
|
||||
this.adjustLeftControlsIndent();
|
||||
}
|
||||
}
|
||||
|
||||
private void adjustLeftControlsIndent() {
|
||||
combinedWindPanel.getParent().setStyleName("CombinedWindPanelParentDiv");
|
||||
trueNorthIndicatorPanel.getParent().setStyleName("TrueNorthIndicatorPanelParentDiv");
|
||||
String leftControlsIndentStyle = getLeftControlsIndentStyle();
|
||||
if (leftControlsIndentStyle != null) {
|
||||
combinedWindPanel.getParent().addStyleName(leftControlsIndentStyle);
|
||||
trueNorthIndicatorPanel.getParent().addStyleName(leftControlsIndentStyle);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2604,4 +2618,11 @@ public class RaceMap extends AbsolutePanel implements TimeListener, CompetitorSe
|
||||
}
|
||||
return mapOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CSS style name to adjust the indent of left controls (combined wind and true north indicator).
|
||||
*/
|
||||
protected String getLeftControlsIndentStyle() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+15
-1
@@ -171,6 +171,8 @@ public class RaceBoardPanel extends SimplePanel implements RaceSelectionChangeLi
|
||||
raceMap = new RaceMap(sailingService, asyncActionsExecutor, errorReporter, timer,
|
||||
competitorSelectionProvider, stringMessages, showMapControls, getConfiguration().isShowViewStreamlets(), getConfiguration().isShowViewStreamletColors(), getConfiguration().isShowViewSimulation(),
|
||||
selectedRaceIdentifier, raceMapResources.combinedWindPanelStyle(), /* showHeaderPanel */ true) {
|
||||
private static final String INDENT_SMALL_CONTROL_STYLE = "indentsmall";
|
||||
private static final String INDENT_BIG_CONTROL_STYLE = "indentbig";
|
||||
@Override
|
||||
public void onResize() {
|
||||
super.onResize();
|
||||
@@ -178,10 +180,22 @@ public class RaceBoardPanel extends SimplePanel implements RaceSelectionChangeLi
|
||||
@Override
|
||||
public void execute() {
|
||||
// Show/hide the leaderboard panels toggle button text based on the race map height
|
||||
leaderboardAndMapViewer.setLeftComponentToogleButtonTextVisibility(raceMap.getOffsetHeight() > 400);
|
||||
leaderboardAndMapViewer.setLeftComponentToggleButtonTextVisibilityAndDraggerPosition(raceMap.getOffsetHeight() > 400);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLeftControlsIndentStyle() {
|
||||
// Calculate style name for left control indent based on race map height an leaderboard panel visibility
|
||||
if (raceMap.getOffsetHeight() <= 300) {
|
||||
return INDENT_BIG_CONTROL_STYLE;
|
||||
}
|
||||
if (leaderboardPanel.isVisible() && raceMap.getOffsetHeight() <= 500) {
|
||||
return INDENT_SMALL_CONTROL_STYLE;
|
||||
}
|
||||
return super.getLeftControlsIndentStyle();
|
||||
}
|
||||
};
|
||||
CompetitorFilterPanel competitorSearchTextBox = new CompetitorFilterPanel(competitorSelectionProvider, stringMessages, raceMap,
|
||||
new LeaderboardFetcher() {
|
||||
|
||||
+8
-3
@@ -314,16 +314,21 @@ public class SideBySideComponentViewer implements ComponentViewer, UserStatusEve
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows/hides the text on left components toggle button by modifying CSS <code>font-size</code> property.
|
||||
* Shows/hides the text on left components toggle button by modifying CSS <code>font-size</code> property and adjust
|
||||
* the dragger position by modifying CSS <code>margin-top</code> property.
|
||||
*
|
||||
* @param visible <code>true</code> to show the button text, <code>false</code> to hide it
|
||||
* @param visible
|
||||
* <code>true</code> to show the button text, <code>false</code> to hide it
|
||||
*/
|
||||
void setLeftComponentToogleButtonTextVisibility(final boolean visible) {
|
||||
void setLeftComponentToggleButtonTextVisibilityAndDraggerPosition(final boolean visible) {
|
||||
Splitter leftScrollPanelSplitter = splitLayoutPanel.getAssociatedSplitter(leftScrollPanel);
|
||||
if (leftScrollPanelSplitter != null) {
|
||||
Style toggleButtonStyle = leftScrollPanelSplitter.getToggleButton().getElement().getStyle();
|
||||
if (visible) toggleButtonStyle.clearFontSize();
|
||||
else toggleButtonStyle.setFontSize(0, Unit.PX);
|
||||
Style drapperStyle = leftScrollPanelSplitter.getDragger().getElement().getStyle();
|
||||
if (visible) drapperStyle.clearMarginTop();
|
||||
else drapperStyle.setMarginTop(-25, Unit.PX);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user