MCPcopy Create free account
hub / github.com/SolarLune/masterplan / placeCardInStack

Function placeCardInStack

utils.go:1139–1161  ·  view source on GitHub ↗
(card *Card, centerIfNoSelection bool)

Source from the content-addressed store, hash-verified

1137}
1138
1139func placeCardInStack(card *Card, centerIfNoSelection bool) {
1140
1141 selection := globals.Project.CurrentPage.Selection.AsSlice()
1142 if len(selection) > 0 && globals.Settings.Get(SettingsPlaceNewCardsInStack).AsBool() {
1143 card.Rect.X = selection[0].Rect.X
1144 card.Rect.Y = selection[0].Rect.Y + selection[0].Rect.H
1145 for _, t := range selection[0].Stack.Tail() {
1146 t.Rect.Y += card.Rect.H
1147 t.LockPosition()
1148 globals.Project.UndoHistory.Capture(NewUndoState(t))
1149 }
1150 card.LockPosition()
1151 globals.Project.Camera.FocusOn(false, card)
1152 } else if centerIfNoSelection {
1153 card.SetCenter(globals.Project.Camera.TargetPosition)
1154 globals.Project.Camera.FocusOn(false, card)
1155 }
1156
1157 globals.Project.UndoHistory.Capture(NewUndoState(card))
1158 globals.Project.CurrentPage.Selection.Clear()
1159 globals.Project.CurrentPage.Selection.Add(card)
1160
1161}
1162
1163// const RegexOnlyDigitsAndColon = `[\d:]`
1164const RegexNoNewlines = `[^\n]`

Callers 3

GlobalShortcutsMethod · 0.85
UpdateTextureMethod · 0.85
ConstructMenusFunction · 0.85

Calls 11

NewUndoStateFunction · 0.85
AsSliceMethod · 0.80
AsBoolMethod · 0.80
TailMethod · 0.80
CaptureMethod · 0.80
FocusOnMethod · 0.80
SetCenterMethod · 0.80
GetMethod · 0.45
LockPositionMethod · 0.45
ClearMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected