Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component prepositioned at origin #29

Open
weerox opened this issue May 4, 2020 · 6 comments
Open

Component prepositioned at origin #29

weerox opened this issue May 4, 2020 · 6 comments
Assignees
Labels
area-GUI bug Something isn't working C# Something relates to the C# part of the codebase

Comments

@weerox
Copy link
Collaborator

weerox commented May 4, 2020

When selecting a component tool or immediately after placing a component, the new component, which should be positioned at the cursor, is instead positioned at what I guess is the origin of the "canvas".

@weerox
Copy link
Collaborator Author

weerox commented May 4, 2020

One solution to this might be to delay the drawing of the component before the mouse has moved. This would work with the current workflow, since when the mouse is up at the toolbar we shouldn't be able to see the component anyway, and when we have just placed a component, the new one wouldn't be visible anyway since they snap to the same point. Though when shortcuts are implemented there might look weird, since we can change tools while being inside the canvas.

@weerox weerox added the bug Something isn't working label May 4, 2020
@NogginBops
Copy link
Collaborator

I agree with this, what we can do is detect if the cursor is inside the drawing area when the tool is selected and enable drawing in that case, and wait until the cursor enters the drawing area in the other case.

@weerox
Copy link
Collaborator Author

weerox commented May 4, 2020

I'd like to look into fixing this, it would be a great opportunity for me to better understand how the components are drawn.

@NogginBops
Copy link
Collaborator

Great, I will leave that to you then 👍

@weerox
Copy link
Collaborator Author

weerox commented May 7, 2020

I took a look at it today and tried to solve it by adding a variable in ComponentTool which keeps track of whether the component should be drawn. The state of the variable is then checked in the Draw() method. The variable is set to false immediately after the tool has been selected.

This partially solved the problem, the component isn't drawn directly when switching tools, but it is drawn when the mouse enter the Circuit/Package editor "tab bar". It isn't as noticeable since your mouse is on the move and will soon enter the circuit editor anyway, but I'm still not quite satisfied.

Do you have an idea as to how to solve it? The most robust solution would be the one that was suggested above, to detect whether the tool is inside the editor and only draw the component if it is. The problem is that I can't figure out how to do that.

@NogginBops
Copy link
Collaborator

To find out if the component is above the mouse area I would first check if there is like a MouseEntered event that we could hook up to tools, otherwise we could look at the current mouse pos and compare that to the client rectangle of the drawing area and see if the mouse is inside of it. Those would be the ways I would do it. Easiest I think would be the latter.

@NogginBops NogginBops added area-GUI C# Something relates to the C# part of the codebase labels May 7, 2020
@NogginBops NogginBops added this to the Somewhat usable program milestone May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-GUI bug Something isn't working C# Something relates to the C# part of the codebase
Projects
None yet
Development

No branches or pull requests

2 participants