phoenix icon indicating copy to clipboard operation
phoenix copied to clipboard

Include basic grid support as a JavaScript library

Open kasper opened this issue 10 years ago • 9 comments

Perhaps it would be a nice addition to provide a very basic grid support as a JavaScript library that could be included in Phoenix and enabled if desired. This would provide a good starting point for people with little (or none) programming experience.

kasper avatar Nov 23 '15 22:11 kasper

Basic feature set:

Grid prototype

  • set grid size ({w:units,h:units}) absolute
  • adjust grid size ({w: delta, h: delta})
  • get width
  • get height

Layout prototype

TBC... allow automatic layouts. Tmuxinator has some neat ideas here IIRC

Window static methods

  • snap all visible windows to grid

Window prototype new methods

  • snap current window to grid
  • move current window around grid (ie. Window::gridMove({x: delta, Y delta}) )
  • size current window using grid (ie. Window::gridResize({w: delta, h: delta}) )

To be continued ...

jasonm23 avatar Nov 24 '15 00:11 jasonm23

Additionally, I think it should support basic alignment methods such as: top left, top right, bottom right, bottom left and centre. I’m considering creating a new repository for this (with tests and style checks) and linking it through a submodule. This could be a focus for a 2.x release.

kasper avatar Nov 25 '15 18:11 kasper

This would be awesome :+1: This way users don't need to reinvent the same thing over and over.

khalidchawtany avatar Nov 25 '15 18:11 khalidchawtany

There’s now a build environment integrated in this project that allows adding features in JavaScript (f1ae8682795f79d7d12cec4b21f45673031fac5e).

kasper avatar Jun 23 '16 10:06 kasper

Linking my humble implementation of a grid system, if someone finds it useful: https://github.com/ngryman/phoenix/blob/master/lib/grid.js.

@kasper if you are interested I could work on bringing this to Phoenix's core library.

ngryman avatar Jun 30 '18 20:06 ngryman

Ping.

lunacookies avatar Dec 03 '18 08:12 lunacookies

@ngryman Nice, sorry for not responding earlier! Feel free to work on adapting your grid implementation to the core library. 😄

kasper avatar Dec 29 '18 11:12 kasper

@kasper @ngryman Cool, hopefully it gets in soon 👍

lunacookies avatar Dec 31 '18 15:12 lunacookies

@kasper Alright, I'll try to find some spare time to open a PR. Meanwhile @arzg you can almost copy/paste my implementation.

ngryman avatar Dec 31 '18 15:12 ngryman