dnd-grid icon indicating copy to clipboard operation
dnd-grid copied to clipboard

exposing some events

Open kevinlvhsl opened this issue 8 years ago • 5 comments

Would you consider exposing some events to external eavesdropping? In order for developers to be more flexible in controlling component details

kevinlvhsl avatar Nov 01 '17 01:11 kevinlvhsl

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.

dattn avatar Nov 08 '17 10:11 dattn

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.

apooslr avatar Nov 14 '17 13:11 apooslr

Events have been implemented by @stanogurnik. Previous and current coordinates are not yet passed to the callbacks.

dattn avatar Jun 15 '18 08:06 dattn

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 avatar Jun 18 '18 09:06 stanogurnik

@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)">

tyrauber avatar Feb 05 '20 12:02 tyrauber