-
Notifications
You must be signed in to change notification settings - Fork 85
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
Fixed: lane arrows don't get reset if the lane arrow window is not focused #856
Conversation
Is this related to #738 (comment) ? |
Yes. I should have modified that comment but I slept. why did you re-open that issue though? |
I prefer it to be done in handlers, instead of checking "IsKeyPressed" every frame. That's just extra work done 60 times per second that eats another 0.001% of the framerate. And we have a LOT of things done every frame. If this is not working I would reconsider routing key events to the tool via the ModUI root class or something like that, where key handlers work without a problem. |
@CitiesSkylinesMods/tmpe The problem is that As we know Here is the problem.
Possible scenarios of
But when you start hitting keys...
Then hold Ctrl+Shift....
Or hold Ctrl+Alt+Shift and Click single time (without modifiers it looks the same) 😄
Of course when you now release all keys within one frame it will probably trigger this combination: Layout | Repaint | Layout | keyUp I am not sure, because it's tricky to test, but i think that if you are getting low fps, chance of multiple |
New |
@kvakvs unfortunately not 😕
|
In that handler only lane arrows window is repositioned to the node. |
You can also use |
in CS NetTool uses OnToolGUI to handle IO events.
That way it is one if statement per frame. The current implementation is not much faster. I mean CO.UI handles events by checking |
Regarding @krzychu124 comment I noticed this: namespace UnityEngine
{
// Token: 0x02000248 RID: 584
public enum EventType
{
MouseDown,
MouseUp,
MouseMove,
MouseDrag,
KeyDown,
KeyUp,
ScrollWheel,
Repaint,
Layout,
DragUpdated,
DragPerform,
DragExited = 15,
Ignore = 11,
Used,
ValidateCommand,
ExecuteCommand,
ContextClick = 16,
MouseEnterWindow = 20,
MouseLeaveWindow,
mouseDown = 0,
mouseUp,
mouseMove,
mouseDrag,
keyDown,
keyUp,
scrollWheel,
repaint,
layout,
dragUpdated,
dragPerform,
ignore,
used
} |
I thik we should put some of that info in to a separate issue ticket to revisit it later as likely lots of GUI stuff can benefit from some performacne tweaks? |
@kvakvs I added a guard so that now it is only one if statement per call to If you plan on updating the interface soon to handle events, then we can wait, other lets merge in this fix and then later we can do the performance boost. |
Its a two sided blade. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Fixes #738
Bug:
Lane Arrows do not respond to reset button if the lane arrow tool does not have focus.
Steps to reproduce:
1- change lane arrows for a segment.
2- select another segment and the select the original segment.
3- press delete => lane arrows are not reset.
4- click somewhere inside the window and then press delete => lane arrows are not reset.
5- click a lane arrow button and then press delete => lane arrows (for the segment) are reset.
Why:
ToolWIndow.EventClicked
is not triggered until we click a button in the window.My solution:
Check for key press in every frame
Other Solutions
calling
ToolWindow.Focus()
afterToolWindow
is started in response toEventVisibalityChanged
but I think that route is too complicated.