CanvasView in ScrollView

As soon as I am wrapping a CanvasView inside of a Vanilla ScrollView, it slows down drastically compared to not having the scrollview. Is there something to know about that?

The wrapping basically happening like that:

self.canvas = CanvasView((10, 10, -10, -10), self)
self.w.scrollView = ScrollView((10, 10, -10, -10), self.canvas._nsObject)

I got a slider to change the size of the drawing in the CanvasView, and that gets incredibly slow once it’s inside of the scrollView.

Edit:

Maybe this is a direction? I could make it smooth with doing it differently than documented on the vanilla page:

self.w.scrollView = ScrollView((10, 10, -10, -10), None)
self.w.scrollView._nsObject.setDocumentView_(self.canvas._nsObject)

I would have told you to do it like the second example.

Without a proper profiler it is difficult to say what is going wrong.

And did you look into building the UI in Xcode?

1 Like

Thank you! That’s very good to know.

About Xcode: not yet. I got it big on my ToDo list, but I need time for that. Currently I need to quickly make tools for my needs, and I’ way faster with python.