Advanced snapping
I would like to present a functionality (work in progress) called advanced snapping. It extends the simple Snap To Grid function. It will add the following capabilities:
- snapping to fixed margins
- snapping to helper lines (guidelines)
- snapping to other widgets
The third point I would like to implement as “smart” as possible. That is, for example
- the left edge snaps to the left edge of another widget, as long as they are one above the other
- left edge snaps to the right edge + set horizontal spacing, as long as they are next to each other
- and so on...
A simple example of how it works I would like to demonstrate with a video.
https://youtu.be/GCrhbCFgQmY
This is a work in progress. There are quite a few elements missing to work in the most basic version.
I like it. Kind of a simple manual layout manager.
From: etet100 @.> Sent: Sunday, May 12, 2024 3:02 PM To: ImpulseAdventure/GUIslice-Builder @.> Cc: Subscribed @.***> Subject: [ImpulseAdventure/GUIslice-Builder] Advanced snapping (PR #258)
I would like to present a functionality (work in progress) called advanced snapping. It extends the simple Snap To Grid function. It will add the following capabilities:
- snapping to fixed margins
- snapping to helper lines (guidelines)
- snapping to other widgets
The third point I would like to implement as “smart” as possible. That is, for example
- the left edge snaps to the left edge of another widget, as long as they are one above the other
- left edge snaps to the right edge + set horizontal spacing, as long as they are next to each other
- and so on...
A simple example of how it works I would like to demonstrate with a video.
https://youtu.be/GCrhbCFgQmY
This is a work in progress. There are quite a few elements missing to work in the most basic version.
image.png (view on web)https://github.com/ImpulseAdventure/GUIslice-Builder/assets/22624537/b64d68f8-b2c4-4eb4-9b85-c6024d1fabd5
You can view, comment on, or merge this pull request online at:
https://github.com/ImpulseAdventure/GUIslice-Builder/pull/258
Commit Summary
- b12f4a8https://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/commits/b12f4a83015ff1db4dd357d53ed70654e0b30738 Snapper temp
- 983e09ahttps://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/commits/983e09a87f92d1d40543cc43f4fe2ee0f2af34ef Merge branch 'master' into snapper
- 62b86f0https://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/commits/62b86f067e2cfd0a40ee98759cdf905fbbe347bd Big part of the snapping function, snapping, drawing lines
- 68ffe26https://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/commits/68ffe2642a0cfcf39af05fb152bc4d0cbc525e76 Do not use current widget as snapping reference
File Changes
(6 fileshttps://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/files)
- M builder/src/main/java/builder/commands/DragWidgetCommand.javahttps://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/files#diff-50b1e0bae7fe1be427cbc90b73ee069b8096d267f4e954f2b7f11148dd86f1bf (96)
- M builder/src/main/java/builder/commands/ResizeCommand.javahttps://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/files#diff-8d02226945c2c7f4fc4cae18069b09090229cce74e9b3c59fef9d20166270da4 (95)
- A builder/src/main/java/builder/common/Guidelines.javahttps://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/files#diff-d4414b1395b5e2283a3debcb9689b779112a59765225242ac7fa8ef3cc1421ec (45)
- A builder/src/main/java/builder/common/Snapper.javahttps://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/files#diff-4319faecfac1b32e91c3da741ead6108cb1d6c24bbde95b3ba0a28f9c668fce9 (264)
- M builder/src/main/java/builder/views/PagePane.javahttps://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/files#diff-931c3cb72ea014deab5160461ee037cd6ae97f225594823530e170bb3cb7a2b6 (148)
- M builder/src/main/java/builder/widgets/Widget.javahttps://github.com/ImpulseAdventure/GUIslice-Builder/pull/258/files#diff-a4376319dcfdc6b87e7c098fd7cba5a3d96ef64a80dd56028efa51d065ebc5d5 (8)
Patch Links:
- https://github.com/ImpulseAdventure/GUIslice-Builder/pull/258.patch
- https://github.com/ImpulseAdventure/GUIslice-Builder/pull/258.diff
— Reply to this email directly, view it on GitHubhttps://github.com/ImpulseAdventure/GUIslice-Builder/pull/258, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKQIQYUZ2S77WJYYXS6MESLZB64DNAVCNFSM6AAAAABHTA37XCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI4TCNBVHA3DKOI. You are receiving this because you are subscribed to this thread.Message ID: @.***>
A little teaser. Ribbon buttons.
I've made a lot of progress recently but there are still a lot of, difficult problems to solve: E.g.:
- Saving guidelines settings in the project file. I'm not even trying to integrate this into the current binary format. I did the initial serialization to json and this is the only sensible solution.
- Change history (Undo/Redo). Some things work. But already options like CUT, COPY, PASTE require too many changes in the core of the program. I might just disable the ability to use these commands for guidelines.
- Some of the settings (such as line colors) are not configurable. Margins are red, guidelines are white, and so on.
@etet100 While I apprediate the amount of effort you have put into this and
while I liked some aspects of your original idea I'm concerned you have over-designed this feature.
I also don't think guidlines should be persistent. I much prefer the way the Eclipse WindowsBuilder Plug-in works with GroupLayout. With Guidelines appearing only when you select a UI element, Like a JButton. The guidelines are just that. No snap to and they disappear when no UI Elements are selected.
A major concern is that I need to keep backward compatibilty. People need to load older projects. Which is why my json work is taking some time.
I really think you might want to take a pause and rethink this approach,
Paul--
I have experience with many modern applications and I don't think my approach is incorrect. The current program interface is extremely outdated and gives a 90s feel. I also disagree that my solution is over designed. It is still only a small part of what should be in this application.
I will not insist that my changes be included in the main branch. However, I believe that my changes are going in the only right direction.
And sticking to backward compatibility is also a big mistake. Someday you have to get rid of the ballast and allow further development. You can always release a version that bridges the gap between the old and new versions of project files.
I am closing because there is no way to merge these changes anyway.
I will work on my fork.