-
-
Notifications
You must be signed in to change notification settings - Fork 765
Scale nodes by file size #351
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,9 @@ | |
| */ | ||
|
|
||
| #include "file.h" | ||
| #include "gource_settings.h" | ||
| #include <cmath> | ||
| #include <string> | ||
|
|
||
| float gGourceFileDiameter = 8.0; | ||
|
|
||
|
|
@@ -28,6 +31,7 @@ RFile::RFile(const std::string & name, const vec3 & colour, const vec2 & pos, in | |
| hidden = true; | ||
| size = gGourceFileDiameter * 1.05; | ||
| radius = size * 0.5; | ||
| file_size = 0; | ||
|
|
||
| setGraphic(gGourceSettings.file_graphic); | ||
|
|
||
|
|
@@ -73,6 +77,24 @@ RFile::RFile(const std::string & name, const vec3 & colour, const vec2 & pos, in | |
| RFile::~RFile() { | ||
| } | ||
|
|
||
| void RFile::setFileSize(unsigned int new_file_size) { | ||
| file_size = new_file_size; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to animate the file size changing, so it interpolates between the old file size and the new file size, maybe over the same period as the action laser beam. So it would keep the old size but also store the new size, and then it could use another variable like file_size_change_time_elapsed to work out the current size. |
||
|
|
||
| if (gGourceSettings.scale_by_file_size) { | ||
| if (file_size > 0) { | ||
| radius = gGourceSettings.file_scale * log((float)file_size + 1.0f); | ||
| } else { | ||
| radius = gGourceSettings.file_scale; | ||
| } | ||
| size = radius * 2.0f; | ||
| setGraphic(gGourceSettings.file_graphic); | ||
| } | ||
| } | ||
|
|
||
| unsigned int RFile::getFileSize() const { | ||
| return file_size; | ||
| } | ||
|
|
||
| void RFile::remove(time_t removed_timestamp) { | ||
| last_action = elapsed; | ||
| fade_start = elapsed; | ||
|
|
@@ -283,11 +305,13 @@ void RFile::drawNameText(float alpha) { | |
|
|
||
| float name_alpha = selected ? 1.0 : alpha; | ||
|
|
||
| std::string label = gGourceSettings.file_extensions ? ext : name; | ||
|
|
||
| if(selected) { | ||
| file_selected_font.draw(screenpos.x, screenpos.y, name); | ||
| file_selected_font.draw(screenpos.x, screenpos.y, label.c_str()); | ||
| } else { | ||
| file_font.setAlpha(name_alpha); | ||
| file_font.draw(screenpos.x, screenpos.y, gGourceSettings.file_extensions ? ext : name); | ||
| file_font.draw(screenpos.x, screenpos.y, label.c_str()); | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
So this sets the radius to file size. It means the actual dot size will be proportional to file size squared. The area of the dots will not be proportional to file size.