/*******************************************************************************
* Copyright (c) 2017 itemis AG and others.
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Matthias Wienand (itemis AG) - initial API and implementation
*
*******************************************************************************/
package org.eclipse.gef.mvc.fx.ui.actions;
import org.eclipse.gef.geometry.planar.Point;
import org.eclipse.gef.mvc.fx.ui.MvcFxUiBundle;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import javafx.geometry.Bounds;
/**
* The {@link ScrollTopRightAction} is an {@link AbstractScrollAction} that
* aligns the contents of the viewer with the bottom/right viewport position,
* i.e. the bottom/right corner of the contents will be at the bottom/right
* corner of the viewport after performing this action.
*
* @author mwienand
*
*/
public class ScrollBottomLeftAction extends AbstractScrollAction {
/**
* Constructs a new {@link ScrollBottomLeftAction}.
*/
public ScrollBottomLeftAction() {
this("Scroll Bottom/Left", IAction.AS_PUSH_BUTTON,
MvcFxUiBundle.getDefault().getImageRegistry().getDescriptor(
MvcFxUiBundle.IMG_ICONS_SCROLL_BOTTOM_LEFT));
}
/**
* Constructs a new {@link ScrollBottomLeftAction} with the given text and
* style. Also sets the given {@link ImageDescriptor} for this action.
*
* @param text
* Text for the action.
* @param style
* Style for the action, see {@link IAction} for details.
* @param imageDescriptor
* {@link ImageDescriptor} specifying the icon for the action.
*/
protected ScrollBottomLeftAction(String text, int style,
ImageDescriptor imageDescriptor) {
super(text, style, imageDescriptor);
}
@Override
protected Point determinePivotPoint(Bounds bounds) {
return new Point(bounds.getMinX(), bounds.getMaxY());
}
}