ManiacalLabs / SimPixel

WebGL Pixel Art Visualizer
http://simpixel.io
GNU General Public License v3.0
9 stars 7 forks source link

Change point size and dark LED visibility via URL parameters #32

Closed vingkan closed 6 years ago

vingkan commented 6 years ago

Builds on #28 by checking URL parameters to customize point size and dark LED visibility.

Set view to URL parameters

I followed @adammhaile 's suggestion to modify bpHost() into a new function bpParams() that returns a dict of three settings: websocket host, point size, and dark LED visibility. I added two methods to the View class (updateSizeDefault(val) and updateDarkVisible(val)) to set point size and dark LED visibility from main.js and update the display. Those methods also take care of updating the GUI panel controllers, as recommended in the data-gui documentation.

The URL parameters are:

An example URL would be: https://simpixel.io/?host=wss://dreamy-elli_80.ide.mimir.io&size=7&dark=on

Remember parameters in localStorage

I also incorporated @mwcz 's suggestion to save the parameters in localStorage, if possible. I tried the data-gui remember() first, but it added extra selectors and buttons to the top of the panel, which seemed like too much. Instead, I added a method to the View class called rememberParams() to save point size and dark LED visibility to localStorage when they are updated.

rec commented 6 years ago

Any update on this? This pull request seems reasonable, but then I don't really know SimPixel nearly as well...

adammhaile commented 6 years ago

@rec I have a backlog I'm working through. Hopefully will evaluate this in the next couple of days

On Mon, Oct 15, 2018, 7:37 AM Tom Swirly notifications@github.com wrote:

Any update on this? This pull request seems reasonable, but then I don't really know SimPixel nearly as well...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ManiacalLabs/SimPixel/pull/32#issuecomment-429817204, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6a6gHlBzXKjNvkTYMJwvy3XjZXejV-ks5ulHNvgaJpZM4XW47N .

rec commented 6 years ago

¡No es una problema! Just keeping you honest. ;-)

adammhaile commented 6 years ago

@vingkan See here -> http://beta.simpixel.io/ Looks good to me, but would appreciate you checking it out as well. Then I can promote it to simpixel.io

vingkan commented 6 years ago

It's working like a charm for me! Thanks @adammhaile