Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reposition/resize elements using sketch ? #26

Open
AwaisFayyaz opened this issue Nov 14, 2019 · 4 comments
Open

How to reposition/resize elements using sketch ? #26

AwaisFayyaz opened this issue Nov 14, 2019 · 4 comments

Comments

@AwaisFayyaz
Copy link

Hi daihase,

Thank you very much for such an awsome iOS library for drawing. i am using this in a real application for drawing. One requirement is to move/resize the elements that are currently drawn on sketchView.

Is this possible in this library ? if not, then can you please provide me some hints/guidelines on how i should proceed.

Thanks.

@daihase
Copy link
Owner

daihase commented Nov 15, 2019

@AwaisFayyaz
Thank you for using my library.

This library renders using CoreGraphics.
Therefore, it is impossible to move a once drawn object again.

But if you don't do it all at once, you can move/resize it.
Because SketchView is just a UIView, once it is saved and reloaded, it can be moved and scaled by dragging like a normal UIView.

Does my answer make sense?

@AwaisFayyaz
Copy link
Author

@daihase
Thanks for the quick reply.

Please explain this line "But if you don't do it all at once, you can move/resize it".
Do you mean that i draw one thing. e.g line, then move/resize it, then draw some other thing, then move/resize it and so on ?

End goal is to move/resize individual items in sketch view, not the whole sketch view. For example, i used the line tool to draw a line. Then i used the stamp tool to place a stamp. now i want to move/resize the line and stamp individually.

Hope it clears the issue.

Thanks

@daihase
Copy link
Owner

daihase commented Nov 15, 2019

@AwaisFayyaz
I understood what you wanted to do.
In that case, you need to save the picture drawn with Sketch. (This is because the line drawn using Sketch is completely drawn in SketchView.)

The function you said is frequently seen in drawing app.
For example, load the stamp and tap the screen to paste. Then tap and hold the stamp to move it again or resize it.

In that case, the stamp data is stored in the form of UIImageView in advance, and it is temporarily placed by addSubview in UIView without rendering it on the screen.
Then drag it with UIGestureRecognizer. (resize too)

What I am trying to say is that picture drawn using sketch must be saved as UIView.

As you said,

For example, i used the line tool to draw a line. Then i used the >stamp tool to place a stamp. now i want to move/resize the line and >stamp individually.

whether a line or a figure, everything that is drawn once in SketchView is a UIView. So I think that you should display the screen for drawing lines for dragging and resizing first, and paste it on the other target ViewController later.

※To create a stamp that can be dragged and resized, you need to expand the stamp function of sketch.

I hope this will help.

@AwaisFayyaz
Copy link
Author

Hi,
Thanks for the reply. i was working on some other feature.

what do you mean by this line?

you should display the screen for drawing lines for dragging and resizing first

do you mean i should display lines for dragging and resizing around the drawn elements? so if i drawn a stamp and user wants to drag/resize it, i should display lines around the stamp through which user can drag/resize the stamp.

If this is what you mean, then how can i show lines around the stamp ? and after lines are drawn, how to drag/resize it?

If that is not the case, then please elaborate.

This library is providing me all the functions that i need and library is good and updated. so i want to use this library. Just need drag/resize feature in it.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants