viliusle / miniPaint

online image editor
http://viliusle.github.io/miniPaint/
Other
2.59k stars 602 forks source link

Change the Default Setting of transparent to On #394

Closed takuyaW closed 4 months ago

takuyaW commented 4 months ago

Hello,

First of all, I want to thank you for providing such an amazing project. I've been using miniPaint and have a question regarding the settings option for transparent.

Currently, the transparent option in settings is set to off by default. I was wondering if there's a possibility to change this default setting to on.

viliusle commented 4 months ago

You can change it on config file, rebuild it from sources code and you will have modified version with that change.

If you are talking about changing it for everybody on https://viliusle.github.io/miniPaint/ - this is interesting, but it requires more opinions, research.

takuyaW commented 4 months ago

I tried making the changes in the config file and ran npm run build, but unfortunately, I didn't see the expected change to a transparent state. It seems that just changing the config settings may not be enough.

viliusle commented 4 months ago

after change, use incognito window (or delete cookies), because once you save settings, it is saved in cookies. Settings works only if user is new and does not have any settings saved yet.

takuyaW commented 4 months ago

I have confirmed that the issue persists even when using an incognito window. Upon reviewing the code again, I identified that the problem is due to the load_default_values method in the base-gui.js file, where the setting is being changed to false. I plan to resolve this issue by changing the relevant code part to true. Thank you.

https://github.com/viliusle/miniPaint/blob/df0f259172234d645abfff91872863b33ab52077/src/js/core/base-gui.js#L92-L103

viliusle commented 4 months ago

Oh, in that case it looks like bug, I would try to remove line 96 at all, since default value should be in config.php- it could solve your issue.

takuyaW commented 4 months ago

Thank you for your quick reply. I think there is a similar problem with the LANG variable, just like when config.TRANSPARENCY doesn't load correctly the first time. In this scenario, I think config.LANG should be loaded if lang is null.

https://github.com/viliusle/miniPaint/blob/df0f259172234d645abfff91872863b33ab52077/src/js/core/base-gui.js#L287-L300