-
Notifications
You must be signed in to change notification settings - Fork 23
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
hud customizer: Add resizing #138
hud customizer: Add resizing #138
Conversation
9485bb0
to
5264f76
Compare
Exciting stuff, looking forward to trying this out! I might need a few days before I can review this properly (definitely need to try out ingame). If you want stuff in the meantime, we're going to need to change layouting of every HUD component to take resize better (a lot of stuff has |
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.
Really tired atm so might be missing, gonna re-read tomorrow but got a few comments.
I tried out ingame and one issue was the resize knobs moving with the virtual panel, not the snapping HUD panel. This looks very strange and not something we want, even if it makes the code more complicated, sorry. Besides that it seems to function well!
scripts/hud/customizer.ts
Outdated
TOP = 1, | ||
TOP_RIGHT = 2, | ||
RIGHT = 3, | ||
BOTTOM_RIGHT = 4, | ||
BOTTOM = 5, | ||
BOTTOM_LEFT = 6, | ||
LEFT = 7, | ||
TOP_LEFT = 8 |
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.
Clearer if the non-move variants are prefixed with RESIZE_
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.
Done
scripts/hud/customizer.ts
Outdated
function getResizeVector(dir: number) { | ||
return [ | ||
[0, -1], | ||
[1, -1], | ||
[1, 0], | ||
[1, 1], | ||
[0, 1], | ||
[-1, 1], | ||
[-1, 0], | ||
[-1, -1] | ||
][dir - 1]; | ||
} |
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.
Much better if we can pass an enum value here - I would just use a map, something like
resizeVector: ReadonlyMap<Exclude<DragMode, DragMode.MOVE>, [number, number]>
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.
Done
ace2aa4
to
95f6010
Compare
I made the knobs stick to the hud panel. Should I squash your commit? |
Fixup is fine |
I'll try out again tomorrow, thanks for fast response! |
0e8d7d3
to
fed00ea
Compare
547facb
to
a7e6827
Compare
scripts/hud/customizer.ts
Outdated
function parsePx(str: string): number | undefined { | ||
if (str && str.slice(-2) === 'px') { | ||
return Number.parseFloat(str.slice(0, -2)); | ||
} | ||
return undefined; | ||
} |
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.
Don't love nested functions like this, just as easy to read if parsePx
is separate, and theoretically this is slower since parsePx
captures panel
(though in practice in V8 it's probably completely fine).
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.
Done
a7e6827
to
bfbf0b0
Compare
bfbf0b0
to
e0d1539
Compare
Added resizing to the hud customizer.
Most hud elements aren't resized properly, but the chat is.
There's a new size property that needs to be added to the hud_default.kv3
Checks
feat: Add foo
,chore: Update bar
, etc...fixup
ed into my original commits.