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

Method Update

contents.go:4825–4873  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4823}
4824
4825func (tc *TableContents) Update() {
4826 tc.DefaultContents.Update()
4827 tc.TableData.Update()
4828 tc.Card.ForceDrawing = tc.TableData.EditingLabel != nil
4829
4830 if globals.State == StateNeutral && tc.Card.selected {
4831
4832 if globals.Keybindings.Pressed(KBTableAddColumn) {
4833 tc.Card.Recreate(tc.Card.Rect.W+globals.GridSize, tc.Card.Rect.H)
4834 tc.Card.StopResizing()
4835 globals.Keybindings.Shortcuts[KBTableAddColumn].ConsumeKeys()
4836 tc.TableData.Changed = true
4837 }
4838
4839 if globals.Keybindings.Pressed(KBTableDeleteColumn) {
4840 tc.Card.Recreate(tc.Card.Rect.W-globals.GridSize, tc.Card.Rect.H)
4841 tc.Card.StopResizing()
4842 globals.Keybindings.Shortcuts[KBTableDeleteColumn].ConsumeKeys()
4843 tc.TableData.Changed = true
4844 }
4845
4846 if globals.Keybindings.Pressed(KBTableAddRow) {
4847 tc.Card.Recreate(tc.Card.Rect.W, tc.Card.Rect.H+globals.GridSize)
4848 tc.Card.StopResizing()
4849 globals.Keybindings.Shortcuts[KBTableAddRow].ConsumeKeys()
4850 tc.TableData.Changed = true
4851 }
4852
4853 if globals.Keybindings.Pressed(KBTableDeleteRow) {
4854 tc.Card.Recreate(tc.Card.Rect.W, tc.Card.Rect.H-globals.GridSize)
4855 tc.Card.StopResizing()
4856 globals.Keybindings.Shortcuts[KBTableDeleteRow].ConsumeKeys()
4857 tc.TableData.Changed = true
4858 }
4859
4860 }
4861
4862 if tc.TableData.EditingLabel != nil {
4863 tc.Card.Select()
4864 }
4865
4866 tc.SettingsButton.Rect.X = tc.Card.DisplayRect.X
4867 tc.SettingsButton.Rect.Y = tc.Card.DisplayRect.Y + tc.Card.DisplayRect.H
4868
4869 if tc.Card.selected {
4870 tc.SettingsButton.Update()
4871 }
4872
4873}
4874
4875func (tc *TableContents) Draw() {
4876 tc.DefaultContents.Draw()

Callers

nothing calls this directly

Calls 6

StopResizingMethod · 0.80
ConsumeKeysMethod · 0.80
UpdateMethod · 0.65
PressedMethod · 0.45
RecreateMethod · 0.45
SelectMethod · 0.45

Tested by

no test coverage detected