-
-
Notifications
You must be signed in to change notification settings - Fork 994
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
Not able to draw on top of sticker #281
Comments
Wondering if there is any update or feedback on this? I'm still having this issue in 1.5.1. |
Yes, currently it's not supported because using the just on |
Is there any desire to change this? I'm currently testing a change where I bring the drawing view to the front while the brush is enabled then sending it back down to the bottom when I'm done drawing (I'll likely add an apply button or something), which works for my needs. If there is any interest in this feature I'd be happy to contribute my changes. |
Can you share some pseudo code here ? To understand how it works. |
Sure, This is the way I believe things are supposed to work (though if I'm wrong feel free to correct me) View height is controlled by a combination of the View's elevation and TranslationZ, where the elevation is the static part and the TranslationZ is dynamic. A couple of things need to be done in order to move the views around in the Z axis. First, the source image needs to be set lower than any of the views, that way we don't inadvertently put anything behind it. Then we need to have some code that moves the drawing View to the front when the user selects the brush tool and moves it back to the back when the user selects another tool/unselects the brush tool by manipulating the TranslationZ of the drawing View. What that ends up looking like is something like this. protected PhotoEditorImpl(Builder builder) {
.....
imageView.setTranslationZ(-2);//could be any number below -1 really.
.....
}
@Override
public void setBrushDrawingMode(boolean brushDrawingMode) {
if (drawingView != null) {
drawingView.enableDrawing(brushDrawingMode);
if(brushDrawingMode){
drawingView.setTranslationZ(1);
}else{
drawingView.setTranslationZ(-1);
}
drawingView.invalidate();
}
} |
Okay. I understand that But the question is, how it will solve the problem ? Let say if you add a sticker on top of the brush but you want to move the brush above the sticker and set the |
Sorry for the long delay on this. Take a look at these for some extra info on how Z ordering works. Bringing the brush to the front with setTranslationZ(1); will effectively raise it above everything currently on the screen, since its Z is now set to 1 instead of 0 like every other view. When the brush tool is no longer selected, we call setTranslationZ(-1); on the drawing view and which lowers it back down below the stickers. The key is to make sure to put the brush back to what we determine the origin ought to be when we no longer have the brush selected. |
I understand the setTranslation effect. But the concern is it will be on top of all other views i.e text, emoji, and images. |
I thought the line's drawn were underneath all of the stickers by default anyway, so I'm not sure I'm understanding how the line could be above one view and beneath another? |
I cannot seem to draw on top of stickers. When I try to the sticker is moved instead.
Is this the intended behavior? Is there a way to work around this issue?
Thank you.
The text was updated successfully, but these errors were encountered: