
Are you planning on implementing Snap to Grid option at some stage.

I was thinking while lying in bed last night, how it might be easy to implement. Rather than snapping all objects each time one has moved, have the one or group that has been created/moved snapped, this will cut down on the amount of processing required. You could also have an option to snap (only when the option has been manually selected) to snap all of the objects in one go.@electrochrisso : Implementing Snap to Grid option is planned but I have display problems when this option is enabled.
Paris, 8:30 Am, hot coffee. I added some lines in this Nightly version 1.75.electrochrisso wrote:I was thinking while lying in bed last night, how it might be easy to implement. Rather than snapping all objects each time one has moved, have the one or group that has been created/moved snapped, this will cut down on the amount of processing required. You could also have an option to snap (only when the option has been manually selected) to snap all of the objects in one go.
Wow, perfect, i was making a bunch of small flowcharts with MindMap that shows my boss the basic workings of a web app im working on (template/database structure and such) as they like to have everything documented in case he fires me!!, in the previous version you had to be very careful where you placed new objects and it used quite a lot of space, with this automatic system i can save space and and have it look the way i wanted it to the first time round-Automatic calculation of the anchor point of the entity son.
For example, try to place the entity son above the parent entity.
i see what you mean, not to pretty but just a calculation issue, sure we can fix itProblem when moving the entity by pulling the top edge or the left edge.
I hoped you read soon. Maybe get a workaround for this bug.
Code: Select all
;Dessin du cadre de sélection
If \Current = #True
DrawingMode(#PB_2DDrawing_Outlined)
\Width = Int(Round(\Width / 10, #PB_Round_Nearest) * 10) -1
\Height = Int(Round(\Height / 10, #PB_Round_Nearest) * 10) -1
Box(\Left-1, \Top-1, \width+2, \Height+2, SelectBorderColor)
EndIf
Code: Select all
; Déplacement de l'entité parent - Move parent entity
If SnapToGrid = #True
;If Mode = 1 Or mode = 3 Or Mode = 13 Or mode = 23
;*ActiveEntity\Height = *ActiveEntity\Height + *ActiveEntity\Top-GetNearPoint(*ActiveEntity\Top, SnapY)
*ActiveEntity\Height = Int(Round(*ActiveEntity\Height / 10, #PB_Round_Nearest) * 10) -1
;*ActiveEntity\Width = *ActiveEntity\Width + *ActiveEntity\Left-GetNearPoint(*ActiveEntity\Left, SnapX)
*ActiveEntity\Width = Int(Round(*ActiveEntity\Width / 10, #PB_Round_Nearest) * 10) -1
;EndIf
*ActiveEntity\Left = GetNearPoint(*ActiveEntity\Left, SnapX)
*ActiveEntity\Top = GetNearPoint(*ActiveEntity\Top, SnapY)
EndIf
Code: Select all
; Déplacement de l'entité parent - Move parent entity
If SnapToGrid = #True
*ActiveEntity\Height = GetNearPoint(*ActiveEntity\Height, SnapY) -1
*ActiveEntity\Width = GetNearPoint(*ActiveEntity\Width, SnapX) -1
*ActiveEntity\Left = GetNearPoint(*ActiveEntity\Left, SnapX)
*ActiveEntity\Top = GetNearPoint(*ActiveEntity\Top, SnapY)
EndIf
Oh yeh! I forgot to change the 10 for snap var, I was testing for 10 pixels at the time, silly me.Thank you but ...... If you change the spacing points (Preferences Project-> SnapSize), your code no longer works.