-
Notifications
You must be signed in to change notification settings - Fork 36
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
Resize picture #1
Comments
I couldn't find a quick way how to do it. Do you know how this can be done? Any pull requests are welcome. |
Hello, I don't know whether it is possible, but if you can catch OnTouchEvent on the picture, you can then use a ScaleGestureDetector. With this, the user could not change the proportions of the image, however. |
After a little research I think it's not possible to draw drag handles natively as it seems you cannot draw on an Android WebView. The only way to do this seems to be in JavaScript - which I don't know how to do. But what do you think of when the user clicks on an image, then a native dialog gets displayed and the user then can select the size in pixels or percent? In this dialog I could also add a button to download the image to local storage or embed it in html (see #2). |
I think this is a very good idea. Do you think you could measure the size of the image to display it in the dialog when it is not explicitly mentioned in height and width attributes? Moreover, I found this link to implement a drag-to-resize feature in javascript: |
interactjs looks quite promising. As i only have rare time, could you provide an implementation and then post a pull request? |
I will address the issue, but I am not accustomed to programming in Kotlin. (I usually program with Java.) |
I guess I'm doing something wrong, but I can't clone the project in Android Studio. |
The reason is that you don't know my credentials to publish the library to Maven Central ;) . In build.gradle in RichTextEditorCommon, RichTextEditorAndroid and RichTextEditorJavaFX comment out these lines (almost at the bottom of the file):
And don't be afraid, there should be no need to program any Kotlin. Simply take a look at the file RichTextEditorCommon/src/main/resources/editor/rich_text_editor.js. This JavaScript file wraps the basic functionality around which RichTextEditor is built. |
Thank you. That was obvious, I should have thought about that earlier... Indeed, I didn't have to program any Kotlin. I was not aware you used Javascript for all the editor functions. I successfully implemented:
I made a pull request (I hope I didn't forget to commit any changes). You should also add a license and copyright notice to match the requirements of the Interact's MIT License |
Thank you very much for your efforts and your pull request! You can see the integrated changes on branch feature/ResizeImage. Before I merge it to master, one last question: Do I have to add MIT license file or mention the author somewhere (where?)? |
Maybe you could add the notice in the license file, such as: "This library contains code from the following external library: taye/interact.js |
I added the license info as you suggested. Just released version 1.2.1 to Maven Central and to PlayStore. Please check if the implementation meets your expectations and if so close this issue. |
Rotation is not kept when calling setHtml() I made a new pull request to prevent the user from resizing the image when input is disabled. |
Hello,
I was wondering whether and how the user could manually resize a picture inserted in the editor.
When I select the image, I can't slide the corners of the picture to resize or move it (as I can do with Word or LibreOffice for instance).
It would be very convenient to propose such an option.
Sincerely,
E__Man.
The text was updated successfully, but these errors were encountered: