Revert "refactor: canDropIn 逻辑换到 handleAccept"

This reverts commit 6e177628636611b5a1b1b508dbad5abba2356e95.
This commit is contained in:
mario.gk 2020-07-26 13:59:22 +08:00
parent 5b6792fcb0
commit af473913d4

View File

@ -843,8 +843,12 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
this.sensing = true;
this.scroller.scrolling(e);
const dropContainer = this.getDropContainer(e);
if (!dropContainer) {
if (
!dropContainer ||
// too dirty
(typeof dropContainer.container?.componentMeta?.prototype?.options?.canDropIn === 'function' &&
!dropContainer.container?.componentMeta?.prototype?.options?.canDropIn(e.dragObject.nodes[0]))
) {
return null;
}
@ -1113,6 +1117,10 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
*/
handleAccept({ container, instance }: DropContainer, e: LocateEvent) {
const { dragObject } = e;
if (isRootNode(container)) {
return this.document.checkDropTarget(container, dragObject as any);
}
const meta = (container as Node).componentMeta;
// FIXME: get containerInstance for accept logic use
@ -1121,15 +1129,6 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
return false;
}
if (typeof meta.prototype?.options?.canDropIn === 'function' &&
!meta.prototype?.options?.canDropIn(dragObject.nodes[0])) {
return false;
}
if (isRootNode(container)) {
return this.document.checkDropTarget(container, dragObject as any);
}
// first use accept
if (acceptable) {
/*