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

[BUG] Layer visibility btn #2571

Closed
h3llomoto opened this issue Feb 17, 2020 · 3 comments
Closed

[BUG] Layer visibility btn #2571

h3llomoto opened this issue Feb 17, 2020 · 3 comments

Comments

@h3llomoto
Copy link

If I change the state of the visibility btn - gjs will remove display style and then when I click "show layer" - it won't restore display style.
I think it's a bug. Gjs should save current display's options on layer visibility button click to restore it.

@artf
Copy link
Member

artf commented Feb 23, 2020

I agree 👍

@h3llomoto
Copy link
Author

OK guys I found a hotfix for this problem if you need:

        let itmView = editor.LayerManager.getAll();
        itmView.__proto__.toggleVisibility = function(e) {
            e && e.stopPropagation();
            const model = this.model;
            const style = model.getStyle();
            const hidden = style.display == 'none';

            if (hidden) {
                if (model.attributes.oldStyleDisplay) {
                    style.display = model.attributes.oldStyleDisplay;
                    delete model.attributes.oldStyleDisplay;
                } else {
                    delete style.display;
                }
            } else {
                model.attributes.oldStyleDisplay = style.display;
                style.display = 'none';
            }

            model.setStyle(style);
        }

@artf
Copy link
Member

artf commented Mar 1, 2020

Thanks @h3llomoto the logic is totally correct, I'll make the same change but a bit more idiomatic

@artf artf closed this as completed Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants