user3769846
user3769846

Reputation: 11

Rotate image in CodeNameOne?

I'm working on an app where the user adds some items on an image. What I want is almost exactly like the image below. So far, I can add my custom image on a photo, zoom in/out and move that image, but I want to be able to rotate it as well. Another issue is creating a custom layout like below - a text above/middle of the line/arrow .

See the image here.

Upvotes: 1

Views: 201

Answers (1)

Diamond
Diamond

Reputation: 7483

To rotate an image without pinching, just call `myImage.rotate(degreesToRotate);.

As for the layout issue, the image you mentioned is not attached.

Currently only pinch support exists in Codename One which at this time doesn't support the rotate gesture internally. You can implement it by overriding the pointerDrag(int[],int[]) method and detecting rotation then avoiding the call to super and using the rotate transform on the graphics or method on the image.

To get a sense of how something like this would look check out how pinch was implemented internally.

Upvotes: 2

Related Questions