Design question, again..

Design question, again..
Yes, I'm asking a lot about design.. But you people are so helpful, so it's hard to not keep asking ;)

So, I have a quite complicated imaging setup where I paint images tile by tile from multi resolution tile sets and the user can draw features on the canvas, etc, etc. I guess my drawing objects would be called the "Controller".

User interaction is by finger or by mouse, i.e. I need to get hold of a lot of input from Form events (OnPanZoom, OnFormTouch, OnPointerDown, etc, etc). Based on the input I put my TScaler to work so I can get hold of new pinch zoom coordinates etc. The scaler also calculates the size of the workspace which is a TLayout inside of a TScrollbox.

Which way do I design this? The way I have done it so far is to send the TLayout and TScrollbox into TScaler upon creation and then let TScaler alter viewportposition, scale, etc directly. But this is not very decoupled.

Should I define an interface for the UI-parts that I need to work with and inject this interface into the scaler? The reason I feel that this might be good is that it feels wrong to "use" FMX.Forms in my controller objects.

How should I marshal the form events into my drawing objects? For now I let the form (View) connect them to public event properties on the drawing object (Controller). Is this how it should be done?

I'm sorry if my questions are stupid and/or not clear. I'm mostly a back-end guy and I really want my view coupling/uncoupling to be right.

Comments