| 1137 | } |
| 1138 | |
| 1139 | func 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:]` |
| 1164 | const RegexNoNewlines = `[^\n]` |