goxr3plus / FX-BorderlessScene

💠 Undecorated JavaFX Scene with implemented move, resize, minimise, maximise, close and Windows Aero Snap controls.
144 stars 31 forks source link

Added Aero Snap feature. #9

Closed bwcsemaj closed 6 years ago

bwcsemaj commented 6 years ago

As the commit states I reworked the aero snap feature. To be honest I'm surprised how long it took me to actually do this. I thought it was going to be simple tweaks. I tried two different attempts that failed. Then I drew a grid of screens with coordinates and saw patterns and applied that to my solution.

I will probably tomorrow go over the code. I added a BUFFER in the calculation so you don't have to perfectly line it on the edge of the screen. This helps when you have multiple monitors; it can be a bitch to align in a corner because your mouse will just go to the next screen.

One bug I noticed say you resize the screen to the very top. The top will go as high and so will the bottom. Because of the buffer, you aren't able to then click on the move node and drag and keep it at top and bottom. I might have to make a gif to show.

Also, exposing the BUFFER or even renaming it so it makes sense might be something people would want to change. I put it at 100 for now but again can easily be anything not negative.

I also believe there probably is a better way to solve this will using Math.abs(...) I tried attempting one of my solutions with it but kept failing so I ended up somewhat hard coding the solution.

bwcsemaj commented 6 years ago

I'm also not very good with github and tried pushing my changes but ran into problems (that's why there are multiple commits). Also, because my formatter is different than the project my code got rid of white space and formatted things that probably didn't need to be formatted. I also don't have comments explaining my solution. But I ran out of time but wanted to update the solution for others to edit or change solution.

goxr3plus commented 6 years ago

Thank your solution will be tested :). Which IDE are you using?

About the formatter look hoe you have to do it my friend.

You write code but never format the whole file. You just select the lines of code that you have written and format only them.

For example now its almost impossible for me to see where the changes are in the code :(. I want from you to copy the original code. And then put the extra lines of code you added without formatting all your file

So we can work together for the solution.

Pretty happy and glad for your contribution and time :) ❤