Moveable: Single moveable control box

Created on 13 Oct 2019  路  7Comments  路  Source: daybrush/moveable

Is it possible to create only one control box for all the elements, which dynamically switches between selected items? It would reduce number of HTML elements and enhance overall app speed when you have 1000+ items on the page.

question solved

Most helpful comment

@outOFFspace

Is this what you want?

https://codepen.io/daybrush/pen/QWLpOby

If this is what you want, you only need to change the target.

```js
const moveable = new Moveable(.....);

moveable.target = document.querySelector(".target1");
// moveable.target = document.querySelector(".target2");
// moveable.target = document.querySelector(".target3");

All 7 comments

@outOFFspace

Is this what you want?

https://codepen.io/daybrush/pen/QWLpOby

If this is what you want, you only need to change the target.

```js
const moveable = new Moveable(.....);

moveable.target = document.querySelector(".target1");
// moveable.target = document.querySelector(".target2");
// moveable.target = document.querySelector(".target3");

@daybrush,
Thank you for quick response! Awesome!

I came across one problem. I'm using vue-moveable and there you have to create instance each time you want to use moveable. The solution you provided involves the use of a single instance of moveable. Any advice in this case?

@outOFFspace

I'm not sure that vue-moveable is not managed by me.

But it seems to be possible to access internal variables.

vueMoveable.moveable.target = document.querySelector(".target2");

I will ask him once.

Can you please provide same example in angular. Thanks.

@shakoorattari

If targets is element or arr length 1, it is a single box.

If the arr length is 2 or more, it is a muli box.


<ngx-moveable
    [target]="targets"
/>

@daybrush Thank you.
But i's facing issues when using frame scene object in angular.
so if possible for you please make a same sample for angular. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ladifire picture ladifire  路  3Comments

wassgha picture wassgha  路  6Comments

tesmem101 picture tesmem101  路  3Comments

copthuy picture copthuy  路  4Comments

adityakrshnn picture adityakrshnn  路  4Comments