-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add category instance navigation feature #111
- Loading branch information
1 parent
3559c52
commit c4e7cd1
Showing
11 changed files
with
194 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package utils; | ||
|
||
import javafx.geometry.Bounds; | ||
import javafx.scene.Node; | ||
import javafx.scene.control.ScrollPane; | ||
import javafx.scene.layout.AnchorPane; | ||
|
||
public class ModelisationNavigator { | ||
|
||
ScrollPane scrollPane; | ||
AnchorPane anchorPane; | ||
|
||
public ModelisationNavigator(ScrollPane scrollPane, AnchorPane anchorPane) { | ||
this.anchorPane = anchorPane; | ||
this.scrollPane = scrollPane; | ||
} | ||
|
||
public void centerNodeInScrollPaneX(Node node) { | ||
double h = this.anchorPane.getBoundsInLocal().getWidth(); | ||
Bounds bounds = | ||
this.anchorPane.sceneToLocal(node.localToScene(node.getBoundsInLocal())); | ||
double y = (bounds.getMaxX() + | ||
bounds.getMinX()) / 2.0; | ||
double v = this.scrollPane.getViewportBounds().getWidth(); | ||
this.scrollPane.setHvalue(this.scrollPane.getHmax() * ((y - 0.5 * v) / (h - v))); | ||
} | ||
|
||
public void centerNodeInScrollPaneY(Node node) { | ||
double h = this.anchorPane.getBoundsInLocal().getHeight(); | ||
Bounds bounds = | ||
this.anchorPane.sceneToLocal(node.localToScene(node.getBoundsInLocal())); | ||
double y = (bounds.getMaxY() + | ||
bounds.getMinY()) / 2.0; | ||
double v = this.scrollPane.getViewportBounds().getHeight(); | ||
this.scrollPane.setVvalue(this.scrollPane.getHmax() * ((y - 0.5 * v) / (h - v))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.