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

Freeze and unfreeze grid #142

Open
MikeSpock opened this issue Nov 30, 2022 · 1 comment
Open

Freeze and unfreeze grid #142

MikeSpock opened this issue Nov 30, 2022 · 1 comment

Comments

@MikeSpock
Copy link

I don't see a way to freeze and unfreeze the grid, meaning that all items should become fixed, not draggable or scalable.

I wrote a rather dirty workaround:

const toggleFreeze = (shouldFreeze) => {
        for(let item of items){
            for(let key in item){
                if(typeof(item[key].fixed) === 'boolean' ){
                    item[key].fixed = !!shouldFreeze;
                    item[key].resizable = !!shouldFreeze;
                    item[key].draggable = !!shouldFreeze;
                }
            }
        }
    }

but it has one caveat. After toggling the grid needs to update in order to change to fixed elements, which I don't know how to trigger within the code. So it waits until some user action to take effect.

Is there any other way to freeze the grid and unfreeze it if necessary?

@vaheqelyan
Copy link
Owner

vaheqelyan commented Nov 30, 2022

check this https://svelte.dev/repl/a908ae0c59ad421cb9d9bc37503f07ef?version=3.53.1

i think the way you update your items does not trigger reactivity

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

No branches or pull requests

2 participants