#3939 closed defect (fixed)
[PATCH]Structure Tree research highlighting too long
Reported by: | Stephen Imhoff | Owned by: | usey11 |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 21 |
Component: | UI & Simulation | Keywords: | simple patch |
Cc: | Patch: |
Description
The "next phase" technology highlighting used in the Structure Tree of the Learn to Play menu is too long; it stops just outside the horizontal area for all structures instead of just after the last structure.
This is really only an issue when the structures available for a particular phase don't fill up the entire horizontal width. IOW, it looks almost okay for the Mauryans 1st phase because almost the entire area is covered (because their trainer unit decreases the space required). It looks a little off for most civilizations' 2nd phase structures, because the structures available are only half as wide as the highlighting.
But expecting something like this:
(...note that in this expected the width of the entire overlay has also changed. Less sure about that.)
Attachments (5)
Change History (15)
by , 8 years ago
Attachment: | actual.png added |
---|
by , 8 years ago
Attachment: | expected.png added |
---|
comment:1 by , 8 years ago
Keywords: | simple added |
---|
comment:2 by , 8 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
by , 8 years ago
Attachment: | draw.js.patch added |
---|
comment:3 by , 8 years ago
Keywords: | rfc patch added |
---|---|
Milestone: | Backlog → Alpha 21 |
Summary: | Structure Tree research highlighting too long → [PATCH]Structure Tree research highlighting too long |
comment:4 by , 8 years ago
comment:5 by , 8 years ago
And don't forget the programmers.json entry.
What I don't like about the patch are the hardcoded numbers.
Take a look at resizeMoreOptionsWindow
of gamesetup.js
to see how those magic numbers can be avoided.
comment:6 by , 8 years ago
Could we center the tech tree box in the middle of the screen on the fly (not the technologies / buildings itself but the larger box around it)?
by , 8 years ago
Attachment: | drawCleanUp.patch added |
---|
comment:7 by , 8 years ago
L148: one ;
too much
I think you should substitute the phaseCount
in L148 with phaseList.length instead of the one in L291.
L141 should use +=
comment:8 by , 8 years ago
Still has these hardcoded offsets. It would be great if it would retrieve those numbers from the GUI objects themselves.
For example the code doesn't need to pass the 40 in prodBar
, since it doens't change it.
You can use:
let foo = Engine.GetGUIObjectByName("foo"); let fooSize = foo.size; fooSize.left = newLeft; foo.size = fooSize;
thus avoid the hardcoded numbers, making it compatible to changing the XML without having to change the JS code.
by , 8 years ago
Attachment: | draw_2.patch added |
---|
comment:10 by , 8 years ago
Keywords: | rfc removed |
---|
Thanks for the patch! This issue had been annoying me for a long time.
What I changed before the commit:
- The whitespace was removed some time ago already
- Using
Engine.GetGUIObjectByName("TreeDisplay").size.left
instead of 76. Magic numbers should be avoided. - Made these neighbors const too.
// Make prod bar
->// Set initial prod bar size and icon
L36 one newline is enough
L148 and L149 can be merged
The
phaseCount
variable isn't really needed as it is used only ones in that function so that can be nuked.(One side note, try to keep the patches as small as possible, so keep the cleanup separated from the logic changes. Do not change it back for this patch though)