|
Re: bug in mvc logo example [message #1819259 is a reply to message #1818855] |
Fri, 10 January 2020 15:10  |
|
Hi Lian,
nice catch!
I looked into it just now together with Tamas. We found that the old part is selected by the FocusAndSelectOnClickHandler that is executed after the CloneOnClickHandler.
There are multiple options for solving this, for example:
1) Overwrite the default FocusAndSelectOnClickHandler, so that it will not be active when cloning is done, as follows:
package org.eclipse.gef.mvc.examples.logo.handlers;
import org.eclipse.gef.mvc.fx.handlers.FocusAndSelectOnClickHandler;
import javafx.scene.input.MouseEvent;
public class FocusAndSelectOnClickHandlerEx extends FocusAndSelectOnClickHandler {
protected boolean isCloneModifierDown(MouseEvent e) {
return e.isAltDown() || e.isShiftDown();
}
@Override
protected boolean isFocusAndSelect(MouseEvent event) {
return super.isFocusAndSelect(event) && !isCloneModifierDown(event);
}
}
2) Overwrite the DefaultHandlerResolver so that only the first IOnClickHandler is executed.
3) Convert the CloneOnClickHandler into a CloneOnDragHandler (implementing IOnDragHandler) so that it is executed after the click handlers.
I created a Bugzilla to keep track of this issue [1]. We need to consider what should be the solution in the example before changing it, though.
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=559029
Best regards,
Matthias
[Updated on: Fri, 10 January 2020 15:10] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01957 seconds