Skip to content

Commit

Permalink
line class, offset changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristopher Guzman committed Dec 2, 2016
1 parent 0f20962 commit bbc8777
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
17 changes: 14 additions & 3 deletions src/main/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import javafx.fxml.FXML;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Label;
import javafx.scene.control.Slider;
import javafx.scene.control.SplitPane;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;

import java.math.BigDecimal;
import java.text.DecimalFormat;
Expand All @@ -30,9 +32,10 @@ public class Controller {

private double MIN_OFFSET = 0.000000000000000001; //10^-18
private double MAX_OFFSET = 0.0000000000000009; //9x10^-16
private int maxResolution = 100;
private BigDecimal maxAsBigDecimal = new BigDecimal("0.000000000000000001").setScale(18, BigDecimal.ROUND_HALF_EVEN);

private int maxResolution = 100;

private DecimalFormat df = new DecimalFormat(".##");
private DecimalFormat offsetFormat = new DecimalFormat("0.0E0");

Expand All @@ -50,14 +53,22 @@ public class Controller {

zoomLabel.setText("0.1x");
zoomSlider.setValue(10);

zoomSlider.valueProperty().addListener(((observable, oldValue, newValue) -> {

double val = newValue.doubleValue() / maxResolution;
System.out.println(val);
zoomLabel.setText("Zoom: " + df.format(val) + "x");

}));

}
GraphicsContext gc = canvas.getGraphicsContext2D();
gc.setLineWidth(2);
gc.setStroke(Color.BLACK);
gc.moveTo(0,0);
gc.lineTo(500, 300);
gc.stroke();

}


}
23 changes: 23 additions & 0 deletions src/main/Line.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main;

import javafx.scene.canvas.Canvas;

/**
* Created by kristopherguzman on 12/2/16.
*/
public class Line {

private int start;
private int end;

public void setStart();

public Line(Canvas canvas, int thickness, int from, int to) {

this.start = canvas.widthProperty().intValue() - start;
this.end = canvas.heightProperty().intValue() - end;

}


}
2 changes: 1 addition & 1 deletion src/view/view.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Font name="Avenir Black Oblique" size="21.0" />
</font>
</Label>
<Slider fx:id="zoomSlider" layoutX="101.0" layoutY="432.0" prefHeight="16.0" prefWidth="410.0" value="30.0" />
<Slider fx:id="zoomSlider" layoutX="101.0" layoutY="432.0" min="10.0" prefHeight="16.0" prefWidth="410.0" value="30.0" />
</children></AnchorPane>
</items>
</SplitPane>

0 comments on commit bbc8777

Please sign in to comment.