Resizing annotation does not working like images

Hi!
Even if I set maintainAspectRatio as true for PTAnnotEditTool, PTAnnotEditTool does not work as images. It can be resized horizontally and vertically instead of only diagonally while resizing by pulling corners of resize widgets. maintainAspectRatio makes just middle of PTResizeWidgetViews hidden. Can you help me please?
Thank you already!

Hi @bilgehan,

Thank you for getting in touch with us about this.
Could you clarify for which annotation types you want to limit the aspect ratio for?

One approach would be to subclass the PTAnnotEditTool and force it to always return true for the maintainAspectRatio property.
We have instructions for subclassing PDFTron components here:

The main thing to keep in mind is that you need to call the -[PTOverrides overrideClass:withClass:] method early on in your app’s lifecycle, a good option is to do it when you initialize PDFNet.

[PTOverrides overrideClass:[PTAnnotEditTool class] withClass:[MyAnnotEditTool class]];

So for example in your subclass you could do the following if you wanted to specify that circle annotations should maintain their aspect ratio:

- (BOOL)maintainAspectRatio
{
    if ([self.currentAnnotation extendedAnnotType] == PTExtendedAnnotTypeCircle) {
        // circle annotations must maintain aspect ratio
        return YES;
    }
    // other annotation types obey the super class' property
    return [super maintainAspectRatio];
}

The above snippets are in Objective-C but you should be able to translate them to Swift if necessary.
Does that approach work for you?

It works! Thank you so much