/** * Zoom in the graph * * <p>拡大表示する。 * * <p>放大表示 */ public void zoomIn() { if (displayNumber > minDisplayNumber) { // 区分缩放方向 if (zoomBaseLine == ZOOM_BASE_LINE_CENTER) { displayNumber = displayNumber - ZOOM_STEP; displayFrom = displayFrom + ZOOM_STEP / 2; } else if (zoomBaseLine == ZOOM_BASE_LINE_LEFT) { displayNumber = displayNumber - ZOOM_STEP; } else if (zoomBaseLine == ZOOM_BASE_LINE_RIGHT) { displayNumber = displayNumber - ZOOM_STEP; displayFrom = displayFrom + ZOOM_STEP; } // 处理displayNumber越界 if (displayNumber < minDisplayNumber) { displayNumber = minDisplayNumber; } // 处理displayFrom越界 if (displayFrom + displayNumber >= stickData.size()) { displayFrom = stickData.size() - displayNumber; } // Listener if (onZoomGestureListener != null) { onZoomGestureListener.onZoom(ZOOM_IN, displayFrom, displayNumber); } } }
/** * Zoom out the grid * * <p>縮小表示する。 * * <p>缩小 */ public void zoomOut() { if (displayNumber < stickData.size() - 1) { if (displayNumber + ZOOM_STEP > stickData.size() - 1) { displayNumber = stickData.size() - 1; displayFrom = 0; } else { // 区分缩放方向 if (zoomBaseLine == ZOOM_BASE_LINE_CENTER) { displayNumber = displayNumber + ZOOM_STEP; if (displayFrom > 1) { displayFrom = displayFrom - ZOOM_STEP / 2; } else { displayFrom = 0; } } else if (zoomBaseLine == ZOOM_BASE_LINE_LEFT) { displayNumber = displayNumber + ZOOM_STEP; } else if (zoomBaseLine == ZOOM_BASE_LINE_RIGHT) { displayNumber = displayNumber + ZOOM_STEP; if (displayFrom > ZOOM_STEP) { displayFrom = displayFrom - ZOOM_STEP; } else { displayFrom = 0; } } } if (displayFrom + displayNumber >= stickData.size()) { displayNumber = stickData.size() - displayFrom; } // Listener if (onZoomGestureListener != null) { onZoomGestureListener.onZoom(ZOOM_OUT, displayFrom, displayNumber); } } }