Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Single moveable control box #54

Open
daybrush opened this issue Oct 25, 2019 · 8 comments
Open

Single moveable control box #54

daybrush opened this issue Oct 25, 2019 · 8 comments
Assignees
Labels
enhancement 🚀 New feature or request

Comments

@daybrush
Copy link
Collaborator

It has props of target in moveable.
Each time the target changes, the moveable box changes.

But only vue is different.

  • vanilla
moveable.target = document.querySelector("'target');
  • react
<Moveable target={document.querySelector(".target")} />
  • Angular
<ngx-moveable [target]="document.querySelector("'target')"/>
  • vue
<vue-moveable>
<div class="target"></div>
</vue-moveable>

daybrush/moveable#55

@probil probil pinned this issue Oct 25, 2019
@probil probil added the enhancement 🚀 New feature or request label Oct 25, 2019
@probil probil self-assigned this Oct 25, 2019
@probil
Copy link
Owner

probil commented Oct 25, 2019

Hey @daybrush
Thanks for your issue

I guess it's wise to support both versions, e.g.

<vue-moveable :target="document.querySelector(".target")">
   <div class="target"></div>
</vue-moveable>

and

<!-- single target -->
<vue-moveable>
   <div class="target"></div>
</vue-moveable>

<!-- multiple targets -->
<vue-moveable>
   <div class="target"></div>
   <div class="target"></div>
</vue-moveable>

What do you think?

@daybrush
Copy link
Collaborator Author

@probil

is it possible?

<vue-moveable :target="document.querySelector('.target')" />

<div class="target"></div>

@probil
Copy link
Owner

probil commented Oct 25, 2019

right now - no. But I can implement it

@probil
Copy link
Owner

probil commented Oct 25, 2019

@probil

is it possible?

<vue-moveable :target="document.querySelector('.target')" />

<div class="target"></div>

I don't think it's possible in general. Vue will look for document key on the component instance. So such code will throw an error. I guess I would need to pass a selector, e.g.

<vue-moveable target=".target" />

@markusnissl
Copy link

I am not a vue expert, therefore no pull request from my side, but I have tested locally following:
I have added to MOVEABLE_PROPS array the target, as props I added target: [HTMLElement], changed the init call of moveable to target: this.target and removed from the template the slot
It seems to work without error in my configuration.

Would be nice, if it works for you as well and you can add the changes.

@probil
Copy link
Owner

probil commented Mar 13, 2020

@markusnissl Thanks for your feedback.
Some work regarding that was done in v1.6 I'll try to find some time this weekend to make it work properly

@mamsoudi
Copy link

mamsoudi commented Apr 5, 2020

Thanks for your great work on this @probil,
But I also find it very useful to add support for groups and also make the API the same as the other libraries. I've had a lot of confusion looking at the examples and just realised that this isn't supported in vue-moveable.
It'd be great if we could have support for groups and not having target passed as slots necessarily! I guess, for now, I would fall back to the vanilla implementation since I need the grouping to work. I am looking forward to having this feature.

@JonathanTreffler
Copy link

Any updates ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement 🚀 New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants