Proposition for scroll panel example improvment
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Read examples/scroll_panel/scroll_panel.c and compare the current drawing coordinates with the attached diff. Use panelContentRec.x and .y for the content position when drawing the grid and rectangle, then run the scroll panel example to confirm the content moves and clips as expected.
Written by the indexing model from the issue text.
Description
Currently inside examples/scroll_panel/scroll_panel.c x and y fields of panelContentRec variable are unused.
Since panelContentRec suppose to represent contents of scroll panel i think those fields should be used as position of scroll panel by being assigned results of panelRec + panelScroll calculation, and be used in drawing grid and rectangle (becasue both of those are visual representation of pane's content) as seen in snippet below
GuiScrollPanel(panelRec, NULL, panelContentRec, &panelScroll, &panelView);
panelContentRec.x = panelRec.x + panelScroll.x;
panelContentRec.y = panelRec.y + panelScroll.y;
BeginScissorMode(panelView.x, panelView.y, panelView.width, panelView.height);
GuiGrid((Rectangle){panelContentRec.x, panelContentRec.y, panelContentRec.width, panelContentRec.height}, NULL, 16, 3, NULL);
EndScissorMode();
if (showContentArea) DrawRectangle(panelContentRec.x, panelContentRec.y, panelContentRec.width, panelContentRec.height, Fade(RED, 0.1));
Current state for comparasion
GuiScrollPanel(panelRec, NULL, panelContentRec, &panelScroll, &panelView);
BeginScissorMode(panelView.x, panelView.y, panelView.width, panelView.height);
GuiGrid((Rectangle){panelRec.x + panelScroll.x, panelRec.y + panelScroll.y, panelContentRec.width, panelContentRec.height}, NULL, 16, 3, NULL);
EndScissorMode();
if (showContentArea) DrawRectangle(panelRec.x + panelScroll.x, panelRec.y + panelScroll.y, panelContentRec.width, panelContentRec.height, Fade(RED, 0.1));
In my opinion this change would make example better by clearly signaling that result panelRec + panelScroll is position of scroll panel content and should be used as such.
I've attached diff file, and can create push request if there's wish to implement such change.
- Dominant language
- C
- Stars
- 5.3k
- Forks
- 410
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raysan5/raygui
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Jstar269/nakagawa-recomp#3753 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Life-Framework/Life-Framework#7017 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
gjrtimmer/jetson-nvmpi#170 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
rofl0r/proxychains-ng#631 ·