cuire / svelte-grid-extended

A draggable and resizable grid layout, for Svelte
https://svelte-grid-extended.vercel.app
MIT License
74 stars 8 forks source link

[Feature Request] Helper to get available position #38

Closed fabiot21 closed 1 year ago

fabiot21 commented 1 year ago

Add an utility or helper class that can return an available position within the grid given a new potential item (only w and h) and current items. This helper could provide the x and y coordinates where the new item can be placed within the items.

The function could be based on getAvailablePosition

fabiot21 commented 1 year ago

(this class could be extended to have more utility functions)

cuire commented 1 year ago

Maybe something like this

<Grid {...} let:controller={gridController} />
gridController.getAvailablePosition()
gridController.somethingUseful()
fabiot21 commented 1 year ago

what about bind:controller={gridController} or import { gridController } from '$lib'? to have a reference outside the Grid component