void scrollVertically(ScrollBar scrollBar) { if (image == null) return; Rectangle canvasBounds = imageCanvas.getClientArea(); int width = Math.round(imageData.width * xscale); int height = Math.round(imageData.height * yscale); if (height > canvasBounds.height) { // Only scroll if the image is bigger than the canvas. int y = -scrollBar.getSelection(); if (y + height < canvasBounds.height) { // Don't scroll past the end of the image. y = canvasBounds.height - height; } imageCanvas.scroll(ix, y, ix, iy, width, height, false); iy = y; } }
void scrollHorizontally(ScrollBar scrollBar) { if (image == null) return; Rectangle canvasBounds = imageCanvas.getClientArea(); int width = Math.round(imageData.width * xscale); int height = Math.round(imageData.height * yscale); if (width > canvasBounds.width) { // Only scroll if the image is bigger than the canvas. int x = -scrollBar.getSelection(); if (x + width < canvasBounds.width) { // Don't scroll past the end of the image. x = canvasBounds.width - width; } imageCanvas.scroll(x, iy, ix, iy, width, height, false); ix = x; } }
/** * Handles a horizontal scroll event * * @param scrollbar the horizontal scroll bar that posted this event */ public void scrollHorizontally(ScrollBar scrollBar) { if (image == null) return; if (imageWidth > visibleWidth) { final int oldOffset = displayFDC.xOffset; final int newOffset = Math.min(scrollBar.getSelection(), imageWidth - visibleWidth); if (oldOffset != newOffset) { paintCanvas.update(); displayFDC.xOffset = newOffset; paintCanvas.scroll(Math.max(oldOffset - newOffset, 0), 0, Math.max(newOffset - oldOffset, 0), 0, visibleWidth, visibleHeight, false); } } }
@Override public void handleEvent(@Nullable org.eclipse.swt.widgets.Event e) { final int hSelection = hBar.getSelection(); final int destX = -hSelection - origin.x; canvas.get().scroll(destX, 0, 0, 0, timeline.getWidth(), timeline.getHeight(), false); barCanvas.get().scroll(destX, 0, 0, 0, timelineBar.contents.getBounds().width, timelineBar.contents.getBounds().height, false); origin.x = -hSelection; } });
@Override public void handleEvent(@Nullable org.eclipse.swt.widgets.Event e) { final int hSelection = hBar.getSelection(); final int destX = -hSelection - origin.x; canvas.get().scroll(destX, 0, 0, 0, timeline.getWidth(), timeline.getHeight(), false); barCanvas.get().scroll(destX, 0, 0, 0, timelineBar.contents.getBounds().width, timelineBar.contents.getBounds().height, false); origin.x = -hSelection; } });
/** * Handles a vertical scroll event * * @param scrollbar the vertical scroll bar that posted this event */ public void scrollVertically(ScrollBar scrollBar) { if (image == null) return; if (imageHeight > visibleHeight) { final int oldOffset = displayFDC.yOffset; final int newOffset = Math.min(scrollBar.getSelection(), imageHeight - visibleHeight); if (oldOffset != newOffset) { paintCanvas.update(); displayFDC.yOffset = newOffset; paintCanvas.scroll(0, Math.max(oldOffset - newOffset, 0), 0, Math.max(newOffset - oldOffset, 0), visibleWidth, visibleHeight, false); } } }
@Override public void handleEvent(@Nullable org.eclipse.swt.widgets.Event e) { final int vSelection = vBar.getSelection(); final int destY = -vSelection - origin.y; canvas.get().scroll(0, destY, 0, 0, timeline.getWidth(), timeline.getHeight(), false); origin.y = -vSelection; } });
/** * Scrolls the canvas horizontally. * * @param scrollBar */ void scrollHorizontal (ScrollBar scrollBar) { Rectangle bounds = canvas.getClientArea(); int x = -scrollBar.getSelection(); if (x + maxX < bounds.width) { x = bounds.width - maxX; } canvas.scroll(x, cy, cx, cy, maxX, maxY, false); cx = x; }
@Override public void handleEvent(@Nullable org.eclipse.swt.widgets.Event e) { final int vSelection = vBar.getSelection(); final int destY = -vSelection - origin.y; canvas.get().scroll(0, destY, 0, 0, timeline.getWidth(), timeline.getHeight(), false); origin.y = -vSelection; } });
@Override public void handleEvent(@Nullable org.eclipse.swt.widgets.Event e) { final int vSelection = vBar.getSelection(); final int destY = -vSelection - origin.y; canvas.scroll(0, destY, 0, 0, timeline.getWidth(), timeline.getHeight(), false); origin.y = -vSelection; } });
/** * Scrolls the canvas vertically. * * @param scrollBar */ void scrollVertical (ScrollBar scrollBar) { Rectangle bounds = canvas.getClientArea(); int y = -scrollBar.getSelection(); if (y + maxY < bounds.height) { y = bounds.height - maxY; } canvas.scroll(cx, y, cx, cy, maxX, maxY, false); cy = y; }
@Override public void handleEvent(org.eclipse.swt.widgets.Event e) { final int hSelection = hBar.getSelection(); final int destX = -hSelection - origin.x; canvas.scroll(destX, 0, 0, 0, timeline.getWidth(), timeline.getHeight(), false); barCanvas.scroll(destX, 0, 0, 0, timelineBar.contents.getBounds().width, timelineBar.contents.getBounds().height, false); origin.x = -hSelection; } });
public void scroll(int destX, int destY, int x, int y, int width, int height, boolean all) { super.scroll(destX, destY, x, y, width, height, false); if (all) { int deltaX = destX - x, deltaY = destY - y; Control[] children = getChildren(); for (int i=0; i<children.length; i++) { Control child = children[i]; Rectangle rect = child.getBounds(); child.setLocation(rect.x + deltaX, rect.y + deltaY); } } }
@Override public void scroll(int destX, int destY, int x, int y, int width, int height, boolean all) { super.scroll(destX, destY, x, y, width, height, false); if (all) { int deltaX = destX - x, deltaY = destY - y; Control[] children = getChildren(); for (int i=0; i<children.length; i++) { Control child = children[i]; Rectangle rect = child.getBounds(); child.setLocation(rect.x + deltaX, rect.y + deltaY); } } }
@Override public void scroll(int destX, int destY, int x, int y, int width, int height, boolean all) { super.scroll(destX, destY, x, y, width, height, false); if (all) { int deltaX = destX - x, deltaY = destY - y; Control[] children = getChildren(); for (int i=0; i<children.length; i++) { Control child = children[i]; Rectangle rect = child.getBounds(); child.setLocation(rect.x + deltaX, rect.y + deltaY); } } }
@Override public void scroll(int destX, int destY, int x, int y, int width, int height, boolean all) { super.scroll(destX, destY, x, y, width, height, false); if (all) { int deltaX = destX - x, deltaY = destY - y; Control[] children = getChildren(); for (int i=0; i<children.length; i++) { Control child = children[i]; Rectangle rect = child.getBounds(); child.setLocation(rect.x + deltaX, rect.y + deltaY); } } }
@Override public void scroll(int destX, int destY, int x, int y, int width, int height, boolean all) { super.scroll(destX, destY, x, y, width, height, false); if (all) { int deltaX = destX - x, deltaY = destY - y; Control[] children = getChildren(); for (int i=0; i<children.length; i++) { Control child = children[i]; Rectangle rect = child.getBounds(); child.setLocation(rect.x + deltaX, rect.y + deltaY); } } }
void scrollPalette(ScrollBar scrollBar) { if (image == null) return; Rectangle canvasBounds = paletteCanvas.getClientArea(); int paletteHeight = imageData.palette.getRGBs().length * 10 + 20; if (paletteHeight > canvasBounds.height) { // Only scroll if the palette is bigger than the canvas. int y = -scrollBar.getSelection(); if (y + paletteHeight < canvasBounds.height) { // Don't scroll past the end of the palette. y = canvasBounds.height - paletteHeight; } paletteCanvas.scroll(0, y, 0, py, paletteWidth, paletteHeight, false); py = y; } }
void scrollVertical() { final org.eclipse.swt.graphics.Point center = getCenteredOrigin(); final Rectangle content = image.getBounds(); final Rectangle client = canvas.getClientArea(); if (client.height > content.height) { origin.y = 0; } else { final int vSelection = vBar.getSelection(); final int destY = -vSelection - center.y; canvas.scroll(center.x, destY, center.x, center.y, content.width, content.height, false); origin.y = -vSelection + origin.y - center.y; } }
void scrollHorizontal() { final org.eclipse.swt.graphics.Point center = getCenteredOrigin(); final Rectangle content = image.getBounds(); final Rectangle client = canvas.getClientArea(); if (client.width > content.width) { origin.x = 0; } else { final int hSelection = hBar.getSelection(); final int destX = -hSelection - center.x; canvas.scroll(destX, center.y, center.x, center.y, content.width, content.height, false); origin.x = -hSelection + origin.x - center.x; } }