Hi Matthias,
Thank you for your quick response. After sending my message, I tried some things and ended implementing what was your suggestion #2 and it seems to work. I was not aware of the AbstractInteractionPolicy#isRegistered API and may be able to use it in the future.
Thanks again! :)
Hi David,
there are two possible solutions to your problem:
1) You can use the AbstractInteractionPolicy#isRegistered(EventTarget) and #isRegisteredForHost(EventTarget) methods to guard interaction policies from performing changes when another interaction policy is adapted to the part that is registered as the controller for the event target. This can be tested when the interaction policy is initialized (i.e. startDrag(), startScroll(), etc. is called). Then, you can set a flag "invalid" if the policy should not perform changes, e.g. "if (!isRegisteredForHost(event.getTarget())) invalid = true; else invalid = false; if (invalid) return;". The test "if (invalid) return;" can be included in all other callback methods. This is the approach implemented by the default policies. 2) You can replace the DefaultTargetPolicyResolver and provide an implementation that better matches your use case, e.g. return only the "closest" policy that can be found. This is also the recommended approach, if you want to exclude visuals from triggering interaction policies.
Best regards,
Matthias
_______________________________________________ gef-dev mailing list gef-dev@xxxxxxxxxxxTo change your delivery options, retrieve your password, or unsubscribe from this list, visit https://urldefense.proofpoint.com/v2/url?u=https-3A__dev.eclipse.org_mailman_listinfo_gef-2Ddev&d=DwICAg&c=0ia8zh_eZtQM1JEjWgVLZg&r=p5T_bzLeHc1NpCMYvHrgC5CC-mrSgR2gNlptZW5Gzms&m=0recaWx2LdXlNlV1jx3aqT4PhwZqQVZRm1pjW7SMB3w&s=B8z2Gusr_BoaN6kl8lxfM7E4Bdh9c8wQJMFV0cKvAvQ&e=
|