TurboImageProject
TurboImageProject copied to clipboard
centering object when added
Hello there, i want to know how to set default new object point at the middle. how can i do this? i tried to set the pivotX and pivotY but it is not working. thanks
Yes library is working fine only this issue bugging me
@cardovaeric Just do like this and It will work :)
mTurboImageView.post(new Runnable() {
@Override
public void run() {
mTurboImageView.addObject(EmojiKeyboardActivity.this, R.drawable.emoti_107);
}
});
But I think that @cardovaeric wants to show the new image in the center of the canvas. Am I right? I will take a look on that. Now I'm very busy. Thanks for the question.
I don't know what you mean @cardovaeric, addObject() place the image in the middle by default:
float cx = getX() + getWidth() / 2;
float cy = getY() + getHeight() / 2;
@Mun0n yes exactly. @hrules6872 , i tried addObject, but the image spawned on top left on the screen , i think it has something to do with pivot . note : i set the imageview width and height to match parent
Add object with click event it will work fine
Like this : btnAddImage.setOnClickListener(new View.OnClickListener() { @OverRide public void onClick(View v) { turboImageView.addObject(this,R.drawable.transparent_image); } });