()
| 224 | } |
| 225 | |
| 226 | func (iconButton *IconButton) Update() { |
| 227 | |
| 228 | if iconButton.Rect.W == 0 && iconButton.Rect.H == 0 { |
| 229 | return |
| 230 | } |
| 231 | |
| 232 | if iconButton.CanPress && (globals.Mouse.CurrentCursor == CursorNormal || globals.Mouse.CurrentCursor == CursorEyedropper) && ClickedInRect(iconButton.Rect, iconButton.WorldSpace) && iconButton.OnPressed != nil && (globals.State == StateNeutral || globals.State == StateCardLink || globals.State == StateTextEditing || globals.State == StateMapEditing) && iconButton.Active { |
| 233 | globals.Mouse.Button(sdl.BUTTON_LEFT).Consume() |
| 234 | iconButton.OnPressed() |
| 235 | iconButton.tween.Reset() |
| 236 | |
| 237 | PlayUISound(UISoundTypeTap) |
| 238 | |
| 239 | } |
| 240 | |
| 241 | if iconButton.CanPress && (globals.Mouse.CurrentCursor == CursorNormal || globals.Mouse.CurrentCursor == CursorEyedropper) && iconButton.OnRightClickPressed != nil && (globals.State == StateNeutral || globals.State == StateCardLink || globals.State == StateTextEditing || globals.State == StateMapEditing) && iconButton.Active && globals.Mouse.WorldPosition().Inside(iconButton.Rect) && globals.Mouse.Button(sdl.BUTTON_RIGHT).Pressed() { |
| 242 | globals.Mouse.Button(sdl.BUTTON_RIGHT).Consume() |
| 243 | iconButton.OnRightClickPressed() |
| 244 | iconButton.tween.Reset() |
| 245 | |
| 246 | PlayUISound(UISoundTypeTap) |
| 247 | |
| 248 | } |
| 249 | |
| 250 | iconButton.Rect.W = iconButton.originalSize.X * iconButton.Scale.X |
| 251 | iconButton.Rect.H = iconButton.originalSize.Y * iconButton.Scale.Y |
| 252 | |
| 253 | } |
| 254 | |
| 255 | func (iconButton *IconButton) Draw() { |
| 256 |
nothing calls this directly
no test coverage detected