()
| 1076 | } |
| 1077 | |
| 1078 | func (project *Project) MouseActions() { |
| 1079 | |
| 1080 | if globals.State == StateNeutral { |
| 1081 | |
| 1082 | if globals.Mouse.Button(sdl.BUTTON_LEFT).PressedTimes(2) && globals.Settings.Get(SettingsDoubleClickMode).AsString() != DoubleClickNothing { |
| 1083 | |
| 1084 | globals.Mouse.Button(sdl.BUTTON_LEFT).Consume() |
| 1085 | |
| 1086 | project.CurrentPage.Selection.BoxSelecting = false |
| 1087 | |
| 1088 | cardType := ContentTypeCheckbox |
| 1089 | if globals.Settings.Get(SettingsDoubleClickMode).AsString() == DoubleClickLast { |
| 1090 | cardType = project.LastCardType |
| 1091 | } |
| 1092 | card := project.CurrentPage.CreateNewCard(cardType) |
| 1093 | |
| 1094 | project.CurrentPage.Selection.Clear() |
| 1095 | project.CurrentPage.Selection.Add(card) |
| 1096 | card.Rect.X = globals.Mouse.WorldPosition().X - (card.Rect.W / 2) |
| 1097 | card.Rect.Y = globals.Mouse.WorldPosition().Y - (card.Rect.H / 2) |
| 1098 | |
| 1099 | card.LockPosition() |
| 1100 | |
| 1101 | } |
| 1102 | |
| 1103 | if globals.Keybindings.Pressed(KBOpenContextMenu) && !globals.MenuSystem.ExclusiveMenuOpen() { |
| 1104 | contextMenu := globals.MenuSystem.Get("context") |
| 1105 | contextMenu.Rect.X = globals.Mouse.Position().X |
| 1106 | contextMenu.Rect.Y = globals.Mouse.Position().Y |
| 1107 | contextMenu.Open() |
| 1108 | contextMenu.Update() |
| 1109 | } |
| 1110 | |
| 1111 | } |
| 1112 | |
| 1113 | if globals.State != StateContextMenu { |
| 1114 | |
| 1115 | if globals.Mouse.Wheel() > 0 { |
| 1116 | scrollSensitivity := percentageToNumber[globals.Settings.Get(SettingsMouseWheelSensitivity).AsString()] |
| 1117 | project.Camera.AddZoom(project.Camera.Zoom * 0.1 * scrollSensitivity) |
| 1118 | } else if globals.Mouse.Wheel() < 0 { |
| 1119 | scrollSensitivity := percentageToNumber[globals.Settings.Get(SettingsMouseWheelSensitivity).AsString()] |
| 1120 | project.Camera.AddZoom(-project.Camera.Zoom * 0.1 * scrollSensitivity) |
| 1121 | } |
| 1122 | |
| 1123 | if globals.Keybindings.Pressed(KBPanModifier) { |
| 1124 | |
| 1125 | pan := globals.Mouse.RelativeMovement().Div(project.Camera.TargetZoom) |
| 1126 | if globals.Settings.Get(SettingsReversePan).AsBool() { |
| 1127 | pan = pan.Mult(-1) |
| 1128 | } |
| 1129 | project.Camera.TargetPosition = project.Camera.TargetPosition.Sub(pan) |
| 1130 | |
| 1131 | } |
| 1132 | |
| 1133 | } |
| 1134 | |
| 1135 | } |
no test coverage detected