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

Modified hexdoc renderer to have a light mode and read draw settings from CSS #653

Merged
merged 10 commits into from
May 11, 2024

Conversation

JohnDog3112
Copy link
Contributor

@JohnDog3112 JohnDog3112 commented Apr 20, 2024

Changes

  • Made my hexdoc renderer read draw settings from CSS
  • Added some cleanup code to delete previously generated images when switching renderers (This was already done when the page is closed/refreshed)
  • Added overrides for the intersection points and segment renderer triangles when in light mode (made them black)

Things to Note

  • The rendered images don't automatically update when the CSS is changed as there was no event for it and I didn't want to have the client constantly checking for changes.
  • Since you need an html element with the CSS styles to get their values, the only thing used to check for changes is if you selected a different palette or renderer.
    • This means that to see changes from the CSS, you need to switch palettes/renderers

@JohnDog3112 JohnDog3112 changed the title Modified HexDoc renderer to have a light mode and read draw settings from CSS Modified hexdoc renderer to have a light mode and read draw settings from CSS Apr 21, 2024
@object-Object object-Object self-assigned this May 5, 2024
@object-Object
Copy link
Member

For the auto-update thing, I have a couple of ideas:

  • Regenerate the image if you reselect the type/palette that are already selected
  • Generate the image each time the pattern drawer is opened, instead of caching it

@object-Object
Copy link
Member

Also noticing some weird pixelation on the edges of the lines here - is there an antialiasing setting we could enable or something?

image

Copy link
Member

@object-Object object-Object left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than those two comments, I think it looks good, though I'm not really that familiar with frontend stuff like this.

@JohnDog3112
Copy link
Contributor Author

Also noticing some weird pixelation on the edges of the lines here - is there an antialiasing setting we could enable or something?

image

So, it turns out, anti-aliasing is enabled for every pattern except gradient... I'm not quite sure how that happened but it's a pretty easy fix.

@JohnDog3112
Copy link
Contributor Author

For the auto-update thing, I have a couple of ideas:

* Regenerate the image if you reselect the type/palette that are already selected

* Generate the image each time the pattern drawer is opened, instead of caching it

I could do either? Though, for both, I would probably add a function to check for changes in the css when reselecting or opening a drawer. I also thought of starting a timer when it detects a manual change in the css (after doing one of the above things)

@JohnDog3112
Copy link
Contributor Author

Also noticing some weird pixelation on the edges of the lines here - is there an antialiasing setting we could enable or something?
image

So, it turns out, anti-aliasing is enabled for every pattern except gradient... I'm not quite sure how that happened but it's a pretty easy fix.

Fixed
image

@JohnDog3112
Copy link
Contributor Author

I implemented two things for updating from css.

  1. Made it so selecting same option refreshes it
  2. Added a function (autoUpdateRenderer) that sets up a function to run every x ms and re-renders the images if it detects a change in the settings. It only checks the css of the first image it finds, so it won't detect changes in individual image css values, but I'm not sure why someone would do that rather than use a css class.

@JohnDog3112 JohnDog3112 requested a review from object-Object May 11, 2024 18:42
@object-Object object-Object enabled auto-merge May 11, 2024 20:50
@object-Object object-Object merged commit 5294b1d into FallingColors:main May 11, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants