UI File
The ui.js file constitutes a dynamic solution for updating the user interface of our calculator, which responds in real-time to user inputs. The file is constructed using javascript, featuring compatibility with either jQuery or generic vanilla javascript for DOM manipulation. Upon each user input, the file is executed for seamless interface updates.
Moreover, the file is capable of updating both the canvas and div elements specified within the input variables of your config.json, making it a versatile tool for UI enhancements.
tip
Use var instead of let in the ui.js to avoid console errors. Variable decleration with const and let can happen at a function level.
#
Template#
Getting input in the ui.js#
SKYCIV_DESIGN.generateInput(convert_to_base_unit_system)The SKYCIV_DESIGN.generateInput(convert_to_base_unit_system) function is used to get the current input in the ui.js file.
The convert_to_base_unit_system
flag can be used convert the input back to the default_unit_system used in the calculate.js.
#
Structuring graphics to work with both unit systemsIt is suggested the the following layout can be used to create graphics that work with both unit systems.
#
Packages#
SVG Section DimensionsSee the SVG Section Dimensions Documentation.
#
SVG Creator PackageSee the SVG Creator Documentation.