Closed Liquid-Blocks closed 2 years ago
After experimenting with the proposed approach, I have problems with the event listener for the button.
The problem is because when handling the click event, the button must call functions that belongs to the StdEnv class. Now even if the called function is passed as a builder argument, it is not executed in the right context and can not access the StdEnv attributes it is suppose to update.
This is the implementation I first tried with and did not work because of the problem stated above.
The second solution is to simply create buttons as functions of the StdEnv as seen bellow:
This second solution does not block the increaseGraphicSettings
from accessing the other StdEnv methods. I will keep experimenting with this approach and look for solutions to send this UI logic in a different file.
This is the solution for now, later we ca transfer the logic in an other class if we find how
As of now, the elements of UI are hard coded in the examples
index.html
as seen in the picture belowThis is very inconvenient for the manipulation and upgrades of the menu. For this reason we should migrate the UI logic inside the
StdEnv
.The approach I propose is to create a
UIController
class. Then, inside that class, create individual class for each menu panel. Each class should look something like:UIController.GraphicSelector.createAndInjectHtmlObject
UIController.Graphicselector.handleGraphicTierClick
The UIController should be able to insert elements in the HTML dom with
createElement()
andappendChild()
.For the simplification of this issue, only the graphic button should be implemented. The two other menu panels (
id="fly-out"
andid="blocker"
) can be ignored, the UI will be rebuild in coming issues.