-
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
LaneArrows facelift and refactor #726
Conversation
This is looking awesome! Do you think we can get this in to the 11.1.1 release? |
Also, can we add a reset button? |
d4f5029
to
ddbeb45
Compare
21d076c
to
ba53a07
Compare
…itial state leaves the tool
Important |
The UI momentarily appears small in middle of screen then pops in to position at chosen user scaling. See attached vid: bandicam 2020-03-31 22-28-14-496.zip Maybe have the UI hidden until it's possitioning/sizing is finalised? With a segment selected, it feels a bit clunky selecting a different segment. Could we make it so I can just click any other junction-entering segment to select it (even if another segment is already selected). Right-click should still de-select current segment as it currently does. The UI still feels a bit big to me, is it possible to allow the scale slider in mod options to go down to 50%? (Currently it's min value is 65%) The tooltip is making the floating panel unnecessarily large when there's less than 3 lanes: Could it word wrap? Or maybe an option to toggle it's display (once I know the shortcut I don't really want to be seeing it every time)? The positioning seems to get offset when screen res is changed in-game. For example, on 1920x1080 (everything above was tested at this res), the panel is shown in centre of junction like so: When I change to 2560x1440 it gets offset like this: Note: everything above was using 65% UI scaling in mod options. I just did a quick test at 100% and the same issues occur. |
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.
see comment above
…ne arrows window on creation
…GeometryUtil class
This now looks like its scaling correctly, and positioning correctly too. |
I'm getting exception when I right click with arrows tool enabled NullReferenceException: Object reference not set to an instance of an object
at TrafficManager.UI.SubTools.LaneArrows.LaneArrowTool.OnToolRightClick () [0x00000] in <filename unknown>:0
at TrafficManager.UI.TrafficManagerTool.OnToolUpdate () [0x00000] in <filename unknown>:0
at ToolBase.Update () [0x00000] in <filename unknown>:0 to be precise it breaks at this line: Log._Debug(string.Format("LaneArrow right click state={0}, new={1}", state, this.fsm_.State)); |
As for extra rendering of direction arcs and disabling the buttons, i am not sure the old UI had this feature either @aubergine10 https://github.com/CitiesSkylinesMods/TMPE/blob/master/TLM/TLM/UI/SubTools/LaneArrowTool.cs#L311-L348 |
@krzychu124 The fix for that rare null exception is now in the next branch i'm working on. Should i backport it to this branch or go like this? The next branch is ready very soon. |
@kvakvs you can leave it there. |
Setting DONOTMERGE, as the next PR will come into this branch, and when all is good, they both can be merged. |
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 👍
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 👍
* Old SubTool became LegacySubtool. New TrafficManagerSubtool is added for LaneArrows * Fixed main tool & state machine behaviour. Tool right click in the initial state leaves the tool * LaneArrows is using new UIBuilder class, button icons for lane arrows * Lane Arrows window UI and sprites and clicks and position connected * Texture loading fixed; Normal icons are now semitransparent inverted * State machine for tool selection fixed and simplified * Rebase on master * Smart sizing and positioning (WIP) * Recursive update OnResize for new U controls * Smart sizing and positioning of controls * Subscription to UI scaling events works; UI, stacking and margins work * Keybind label builder helper in UIBuilder * Recolored Lane Arrow buttons; Delete shortcut works now * Removed obsolete code * Removed keybinds panel; GUI scale range 50..200 now; Repositioning lane arrows window on creation * Moved bunch of static geometry and road calculations into new static GeometryUtil class * UIScaler takes screen size from UIView not from Screen object * Commented on not using Screen.width|height and using UIView.fixedWidth|Height instead * Scaling fixed: using UIView.GetComponent[Camera]().pixelWidth|Height * Torn down the incorrect scaling code * Text scaling fixed, window hopping fixed, clicking other segment correctly exits and reenters edit state * Minor: Documentation and rename * Ignore if left click is landing into LaneArrow editor Window
Fixes #571
New Features
New API for building forms:
U
You can build forms with nested code structure with
using (var x = UIBuilder...) {}
API. Each form component can have an init function, and an optional resize function (which will be called when UI needs resizing) and can reposition and resize each control. The controls can be stacked to previous sibling's right, or below, with spacing if you wish. And controls can have a padding.New UI forms take notifications from the Options UI scale slider and scale accordingly.
(note: The keybinds feature is commented out and will be reintroduced later)
TODO