Open kevinlvhsl opened 7 years ago
Can you give some examples of events ?
Should it be possible to prevent the default behavior ? For example stop moving a box.
All ideas are welcome, but must be well planned.
It might be helpful to have eventlisteners for when a box has been resized or moved. To access the previous and current cordinated of the box etc.
Events have been implemented by @stanogurnik. Previous and current coordinates are not yet passed to the callbacks.
Current/updated coordinates are passed in the events, so what you can do, is to keep coordinates in upper level of component in state, so when event is fired, you will have previous and current state.
I don't think both current and previous coordinates should be passed to every event. I can think several scenarios when previous coordinates can change (eg. server update) during user action (dragging etc.) and you want to handle this at app level
@stanogurnik How does one listen for the resize:end event? I am assuming its $on('resize:end', function(opts){})
, but what is $on on? It isn't on the vue instance (this), nor the dnd-box instance, or library? How does one listen to these events?
Edit: For future reference, I haven't figured out how to programmatically listen to events, but adding an event handler does work:
<dnd-grid-box boxId="box-1" v-on:resizeEnd="resize('box-1', $event)">
Would you consider exposing some events to external eavesdropping? In order for developers to be more flexible in controlling component details