Skip to content

Commit

Permalink
- fixed: left sidebar UV drag&drop not working correctly for custom t…
Browse files Browse the repository at this point in the history
…exture sizes

- fixed: rare crash
  • Loading branch information
tyronx committed May 25, 2021
1 parent 6cc2263 commit 8ef7384
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
5 changes: 5 additions & 0 deletions src/at/vintagestory/modelcreator/gui/left/LeftUVSidebar.java
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,11 @@ private Element currentHoveredElementEntityTextureMode(ArrayList<Element> elems)
TextureEntry texEntry = null;
if (textureCode != null) {
texEntry = ModelCreator.currentProject.TexturesByCode.get(textureCode);
int[] size = ModelCreator.currentProject.TextureSizes.get(textureCode);
if (size != null) {
texWidth = size[0];
texHeight = size[1];
}
}

scale = Face.getVoxel2PixelScale(ModelCreator.currentProject, texEntry);
Expand Down
30 changes: 17 additions & 13 deletions src/at/vintagestory/modelcreator/gui/right/RightTopPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,21 +244,25 @@ public void run() {

public void Draw()
{
int nowMouseX = MouseInfo.getPointerInfo().getLocation().x - ModelCreator.Instance.getX();
int edgeX = ModelCreator.Instance.leftSidebarWidth() + 2 + ModelCreator.canvas.getWidth();

PointerInfo pinfo = MouseInfo.getPointerInfo();

if (pinfo != null) {

if (Math.abs(edgeX - nowMouseX) < 8) {
ModelCreator.Instance.isOnRightPanel=true;
ModelCreator.canvas.setCursor(new java.awt.Cursor(Cursor.E_RESIZE_CURSOR));
overSidebar = true;
} else {
ModelCreator.Instance.isOnRightPanel=false;
if (overSidebar) {
ModelCreator.canvas.setCursor(java.awt.Cursor.getDefaultCursor());
overSidebar = false;
int nowMouseX = pinfo.getLocation().x - ModelCreator.Instance.getX();
int edgeX = ModelCreator.Instance.leftSidebarWidth() + 2 + ModelCreator.canvas.getWidth();


if (Math.abs(edgeX - nowMouseX) < 8) {
ModelCreator.Instance.isOnRightPanel=true;
ModelCreator.canvas.setCursor(new java.awt.Cursor(Cursor.E_RESIZE_CURSOR));
overSidebar = true;
} else {
ModelCreator.Instance.isOnRightPanel=false;
if (overSidebar) {
ModelCreator.canvas.setCursor(java.awt.Cursor.getDefaultCursor());
overSidebar = false;
}
}
}

}
}

0 comments on commit 8ef7384

Please sign in to comment.