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

Function commonTextEditingResizing

contents.go:148–177  ·  view source on GitHub ↗
(label *Label, card *Card)

Source from the content-addressed store, hash-verified

146}
147
148func commonTextEditingResizing(label *Label, card *Card) {
149
150 if label.Editing && label.textChanged {
151
152 size := card.Rect.W
153
154 // Expand
155 if globals.textEditingWrap.AsFloat() == TextWrappingModeExpand {
156 s := globals.TextRenderer.MeasureText(label.Text, 1)
157 size = s.X + 64
158 }
159
160 lineCount := float32(label.LineCount())
161 prevHeight := card.Contents.DefaultSize().Y
162
163 target := lineCount*globals.GridSize + (prevHeight - globals.GridSize)
164 card.Recreate(size, target)
165
166 // Uncollapse if editing
167 if card.Collapsed == CollapsedShade {
168 card.Collapse()
169 }
170
171 if label.MultiEditing && label.Property != nil {
172 card.SyncProperty(label.Property, true)
173 }
174
175 }
176
177}
178
179func NewCheckboxContents(card *Card) *CheckboxContents {
180

Callers 6

NewCheckboxContentsFunction · 0.85
NewNumberedContentsFunction · 0.85
NewNoteContentsFunction · 0.85
NewTimerContentsFunction · 0.85
NewSubPageContentsFunction · 0.85
NewLinkContentsFunction · 0.85

Calls 7

AsFloatMethod · 0.80
MeasureTextMethod · 0.80
LineCountMethod · 0.80
CollapseMethod · 0.80
SyncPropertyMethod · 0.80
DefaultSizeMethod · 0.65
RecreateMethod · 0.45

Tested by

no test coverage detected