Skip to content
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

Global state idea: Tool-level state #64

Closed
ctrlcctrlv opened this issue Mar 14, 2021 · 1 comment
Closed

Global state idea: Tool-level state #64

ctrlcctrlv opened this issue Mar 14, 2021 · 1 comment
Labels
code-quality Doesn't improve user experience, only makes the code better. enhancement New feature or request

Comments

@ctrlcctrlv
Copy link
Collaborator

Having the corners, show_sel_box and the new vws_previews and vws_contours in the global state seems hacky, I think I need to come up with some way to have tool-level state, which is set at the time of tool switch.

So maybe each .rs file in events can define a thread-local state variable, containing a different type, and TOOL_DATA can become a reference to the current tool's data, or something.

Maybe tool data state variables should be a HashMap. Gotta think more about this.

@ctrlcctrlv
Copy link
Collaborator Author

Or maybe it's not a problem to call thread_local! in each events/pan.rs, events/pen.rs etc., and each tool just knows which global variable is its own because it defined it. So pull that job out of state.rs and into the different events/ files. Thoughts?

@ctrlcctrlv ctrlcctrlv added enhancement New feature or request code-quality Doesn't improve user experience, only makes the code better. labels Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-quality Doesn't improve user experience, only makes the code better. enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant