public LimitCommandsVisitor() { DisplayInfoSingleton displayInfo = DisplayInfoSingleton.getInstance(); isNotSmallDisplay = (displayInfo.isPortrait() && displayInfo.getLastHeight() > ScreenInfo.getInstance().SMALL_WIDTH) || (!displayInfo.isPortrait() && displayInfo.getLastHeight() > ScreenInfo.getInstance().SMALL_HEIGHT); }
private int getSpecialWidth() { AllBinaryTiledLayer terrainTiledLayer = geographicMapInterface.getAllBinaryTiledLayer(); DisplayInfoSingleton displayInfo = DisplayInfoSingleton.getInstance(); if (terrainTiledLayer.getWidth() > displayInfo.getLastWidth()) { return terrainTiledLayer.getWidth() - displayInfo.getLastWidth(); } else { return displayInfo.getLastWidth() - terrainTiledLayer.getWidth() + terrainTiledLayer.getCellWidth(); } }
public void scrollMiddleX() throws Exception { AllBinaryTiledLayer terrainTiledLayer = geographicMapInterface.getAllBinaryTiledLayer(); DisplayInfoSingleton displayInfo = DisplayInfoSingleton.getInstance(); // PreLogUtil.put(diffX + CommonSeps.getInstance().SPACE + CommonSeps.getInstance().SPACE + // terrainTiledLayer.getWidth() + CommonSeps.getInstance().SPACE + displayInfo.getLastWidth(), // this, "scrollMiddleX"); this.move(-terrainTiledLayer.getX(), 0); if (terrainTiledLayer.getWidth() < displayInfo.getLastWidth()) { int diffX = ((displayInfo.getLastWidth() - terrainTiledLayer.getWidth()) >> 1); this.move(-diffX, 0); } else { int diffX = ((terrainTiledLayer.getWidth() - displayInfo.getLastWidth()) >> 1); this.move(diffX, 0); } }
// Graphics.HCENTER & Graphics.TOP public void scrollY(int anchor) throws Exception { AllBinaryTiledLayer terrainTiledLayer = geographicMapInterface.getAllBinaryTiledLayer(); DisplayInfoSingleton displayInfo = DisplayInfoSingleton.getInstance(); if (anchor == Graphics.TOP) { LogUtil.put(LogFactory.getInstance("Top", this, "scrollY")); } else if (anchor == Graphics.BOTTOM) { LogUtil.put(LogFactory.getInstance("Bottom", this, "scrollY")); int diffY = (terrainTiledLayer.getHeight() - displayInfo.getLastHeight()); this.move(0, diffY); } else if (anchor == Graphics.VCENTER) { LogUtil.put(LogFactory.getInstance("Center", this, "scrollY")); // Already sees bottom but I want the map at the Center int diffY = (terrainTiledLayer.getHeight() - displayInfo.getLastHeight()) / 2; this.move(0, diffY); } else { throw new Exception("No Such Anchor Supported"); } }