TurboImageProject icon indicating copy to clipboard operation
TurboImageProject copied to clipboard

centering object when added

Open cardovaeric opened this issue 9 years ago • 6 comments

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

cardovaeric avatar Aug 26 '15 14:08 cardovaeric

Yes library is working fine only this issue bugging me

kailash09dabhi avatar Oct 28 '15 15:10 kailash09dabhi

@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);
        }
    });

kailash09dabhi avatar Oct 28 '15 16:10 kailash09dabhi

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.

Mun0n avatar Nov 05 '15 16:11 Mun0n

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;

hrules6872 avatar Nov 06 '15 13:11 hrules6872

@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

cardovaeric avatar Nov 08 '15 07:11 cardovaeric

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); } });

AmeerHamza112 avatar May 27 '22 16:05 AmeerHamza112