Skip to content

What is layout mode and it's implementation.

Shubhankar Sharma edited this page May 18, 2020 · 1 revision

Contributing author: @shubhankarsharma00

When you try to change the dimensions of the subcircuit for a Scope you can do it by clicking Edit Layout in the sidebar. When you click Edit Layout it calls toggleLayoutMode function which hides the properties from sidebar and them initiates temp_buffer which is an instance of layout_buffer class. This buffer is used to reset all the changes made during the layout mode (if the user wishes to do so). Also, in this temp buffer all the input and output nodes are converted to layoutNode which are used to judge where the nodes will be when the circuit will be converted to subcircuit.

Also, the toggling function calls scheduleUpdate function (from engine.js) which calls the layoutUpdate function after a timeout. This function is responsible for updating the new dimensions once they are changed during layout mode.

decreaseLayoutHeight, increaseLayoutHeight, decreaseLayoutWidth, increaseLayoutWidth are four functions binded to the buttons on the right side when in layout mode. Also, there are some helper functions to help with the title placement.

While saving the information for the layout is stored in data.scope[id].layout and this is where it is retrieved from in loadscope function defined in data.js.

Clone this wiki locally