Skip to content

Commit

Permalink
Prepared fix for issue #987.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsschmidt1337 committed Oct 16, 2023
1 parent 0c48753 commit 473d124
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/org/nschmidt/ldparteditor/composite/Composite3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ public Vector4f getScreenXY() {
* y-direction, cell count)
*/
private final Vector4f[] gridData = new Vector4f[] { new Vector4f(), new Vector4f(), new Vector4f(), new Vector4f(), new Vector4f(), new Vector4f(), new Vector4f(), new Vector4f() };


private float gridSize = 0f;

/** the {@linkplain GLCanvas} */
private final GLCanvas canvas;
private final GLCapabilities capabilities;
Expand Down Expand Up @@ -1573,6 +1575,17 @@ public GLCapabilities getCapabilities() {
public Vector4f[] getGrid() {
return gridData;
}

public void setGridSize(float gridSize) {
this.gridSize = gridSize;
}

/**
* @return the grid size in LDU.
*/
public float getGridSize() {
return gridSize;
}

/**
* @return {@code true} if the origin is shown.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ private void calculateGrid() {
grid[2].set(0f, -gridSize);
// Multiplicants
grid[3].set(mx, my);
c3d.setGridSize((float) (Math.round(gridSize / c3d.getZoom() * 100.0) / 100_000.0d));
gridSize = gridSize * 10f;
int mx10 = (int) (c3d.getBounds().width / gridSize + 4) / 2;
int my10 = (int) (c3d.getBounds().height / gridSize + 4) / 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,13 @@ public void applyValue() {
NLogger.debug(MiscToggleToolItem.class, "Snap on Y :" + snapOnY); //$NON-NLS-1$
NLogger.debug(MiscToggleToolItem.class, "Snap on Z :" + snapOnZ); //$NON-NLS-1$

final VertexManager vm = c3d.getLockableDatFileReference().getVertexManager();
final float gridSize = c3d.getGridSize();
final Set<Vertex> sv = vm.getSelectedVertices();

NLogger.debug(MiscToggleToolItem.class, "Grid size :" + gridSize + " LDU"); //$NON-NLS-1$ //$NON-NLS-2$
NLogger.debug(MiscToggleToolItem.class, "Vertex count:" + sv.size()); //$NON-NLS-1$

// FIXME Needs implementation!
}
});
Expand Down

0 comments on commit 473d124

Please sign in to comment.