MCPcopy Create free account
hub / github.com/PaulleDemon/PyUIBuilder / getLayoutCode

Function getLayoutCode

src/frameworks/customtk/widgets/checkButton.js:204–231  ·  view source on GitHub ↗

* * The index is required for pack as in pack every widget would be packed on top of each other in radio button

({index=0})

Source from the content-addressed store, hash-verified

202 * The index is required for pack as in pack every widget would be packed on top of each other in radio button
203 */
204 getLayoutCode({index=0}){
205 let layoutManager = super.getLayoutCode()
206
207 const {layout: parentLayout, direction, gap, align="start"} = this.getParentLayout()
208 const absolutePositioning = this.getAttrValue("positioning")
209
210
211 if (parentLayout === Layouts.PLACE || absolutePositioning){
212 const config = {}
213
214 const elementRect = this.firstDivRef.current?.getBoundingClientRect()
215
216 config['x'] = Math.trunc(this.state.pos.x)
217 config['y'] = Math.trunc(this.state.pos.y)
218
219 if (elementRect?.height){
220 config['y'] = Math.trunc(config['y'] + (index * elementRect.height)) // the index is the radiobutton index
221 }
222
223 const configStr = convertObjectToKeyValueString(config)
224
225 layoutManager = `place(${configStr})`
226
227 }
228
229 return layoutManager
230
231 }
232
233 getToolbarAttrs(){
234

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected