How to limit the freehand drawing inside diagram area

When freehand drawing goes out of diagram area, drawing happens but scroll bar appears .I don’t want scroll bar.I want to limit the drawing inside diagram area.Is it possible ?

Have you seen this sample: Absolute positioning within the viewport ?


I used the { dragComputation: stayInFixedArea }, from sample
But stayInFixedArea() is not invoked.

That event handler is invoked by the DraggingTool.

Or are you asking about limiting how far the FreehandDrawingTool can draw? For that you need to modify the mouse move behavior to stay within the viewport.