(label *Label, card *Card)
| 146 | } |
| 147 | |
| 148 | func 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 | |
| 179 | func NewCheckboxContents(card *Card) *CheckboxContents { |
| 180 |
no test coverage detected