layoutUpdate() {
        var update = false;
        update |= this.newElement;
        if (this.newElement) {
            this.subcircuitMetadata.x = simulationArea.mouseX;
            this.subcircuitMetadata.y = simulationArea.mouseY;

            if (simulationArea.mouseDown) {
                this.newElement = false;
                simulationArea.lastSelected = this;
            } else return;
        }

        if (!simulationArea.hover || simulationArea.hover == this)
            this.hover = this.isHover();

        if ((this.clicked || !simulationArea.hover) && this.isHover()) {
            this.hover = true;
            simulationArea.hover = this;
        } else if (!simulationArea.mouseDown && this.hover && this.isHover() == false) {
            if (this.hover) simulationArea.hover = undefined;
            this.hover = false;
        }

        if (simulationArea.mouseDown && (this.clicked)) {
            this.drag();
            update |= true;
        } else if (simulationArea.mouseDown && !simulationArea.selected) {
            this.startDragging();
            simulationArea.selected = this.clicked = this.hover;
            update |= this.clicked;
        } else {
            if (this.clicked) simulationArea.selected = false;
            this.clicked = false;
            this.wasClicked = false;
        }

        if (simulationArea.mouseDown && !this.wasClicked) {
            if (this.clicked) {
                this.wasClicked = true;
                simulationArea.lastSelected = this;
            }
        }

        if (!this.clicked && !this.newElement) {
            let x = this.subcircuitMetadata.x;
            let y = this.subcircuitMetadata.y; 
            let yy = tempBuffer.layout.height;
            let xx = tempBuffer.layout.width;

            let rX = this.layoutProperties.rightDimensionX;
            let lX = this.layoutProperties.leftDimensionX;
            let uY = this.layoutProperties.upDimensionY;
            let dY = this.layoutProperties.downDimensionY;

            if (lX <= x && x + rX <= xx && y >= uY && y + dY <= yy)
                return;

            this.subcircuitMetadata.showInSubcircuit = false;
            fillSubcircuitElements();
        }

        return update;
    }
Used to update the state of the elements inside the subcircuit in layout mode
Return Value: true if the state has changed, false otherwise