acerbetti / ACEDrawingView

An open source iOS component to create a drawing app
Apache License 2.0
665 stars 171 forks source link

DraggableText issue #66

Open eyganeshv opened 8 years ago

eyganeshv commented 8 years ago

ACEDrawingView Version : 2.0.1

added some draggable texts into drawingview. But it would not appear in preview. Please see attach file.

simulator screen shot 18-oct-2016 6 09 40 pm simulator screen shot 18-oct-2016 6 10 17 pm

Please could you do fix it.

cainunable commented 8 years ago

I ran into the same problem on a branch that I was playing around with. I managed to fix it in my local translation (which is now written in C#) but someone working on this could do a similar fix in Objective C.

In AceDrawingView.drawings(), after the looping over the pathArray and calling [tool draw] on each, I did something like this:

foreach (UIView childView in Subviews)
{
    if (childView is AceDrawingLabelView)
    {
        AceDrawingLabelView labelView = childView as AceDrawingLabelView;
        CGContext context = UIGraphics.GetCurrentContext();
        context.TranslateCTM(labelView.Frame.Location.X, labelView.Frame.Location.Y);
                context.RotateCTM((System.nfloat)AceDrawingLabelView.CGAffineTransformGetAngle(labelView.Transform));
        labelView.Layer.RenderInContext(context);
        context.TranslateCTM(-labelView.Frame.Location.X, -labelView.Frame.Location.Y);

    }
}
cor0na commented 7 years ago

Please translate the above @cainunable 's C# to Objective-C code...

rlustemberg commented 6 years ago

Actually issue 76 included a PR for a fix for that, simpler than looping over the subviews. The problem is that @acerbetti forgot to modify the - (UIImage *)applyDrawToImage:(UIImage *)baseImage method. I'll provide a PR for that