Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
d74b38c9dThis file is pinned to the selected release. Download the original to open it in your design tool.
package com.marginallyclever.makelangelo.actions;
import com.marginallyclever.makelangelo.paper.Paper;
import com.marginallyclever.makelangelo.preview.Camera;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* An action to zoom the camera to fit the entire paper area.
*/
public class ZoomToFitAction extends NamedAbstractAction {
private final Camera camera;
private final Paper paper;
public ZoomToFitAction(String label, Camera camera, Paper paper) {
super(label);
this.camera = camera;
this.paper = paper;
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control backspace"));
}
@Override
public void actionPerformed(ActionEvent e) {
camera.zoomToFit(paper.getPaperWidth(),paper.getPaperHeight());
}
}