|
|
|
@ -122,18 +122,23 @@ export class EditorComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dropEndHandler(event: CdkDragDrop<WorldArea[]> | CdkDragDrop<PlanElement[]>) {
|
|
|
|
|
let bounds = this.planElemFilterBounds();
|
|
|
|
|
let end = this.plan.plan.length;
|
|
|
|
|
if (bounds) {
|
|
|
|
|
end = bounds[1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isWorldAreaEvent(event) && this.areas) {
|
|
|
|
|
this.plan.plan.splice(end, 0, this.planItemFromArea(event.previousContainer.data[event.previousIndex]));
|
|
|
|
|
this.scrollToEnd();
|
|
|
|
|
this.plan.plan.splice(this.getEnd(), 0, this.planItemFromArea(event.previousContainer.data[event.previousIndex]));
|
|
|
|
|
} else {
|
|
|
|
|
moveItemInArray(this.plan.plan, event.previousIndex, this.getEnd());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.scrollToEnd();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getEnd() {
|
|
|
|
|
let bounds = this.planElemFilterBounds();
|
|
|
|
|
if (bounds) {
|
|
|
|
|
return bounds[1];
|
|
|
|
|
} else {
|
|
|
|
|
moveItemInArray(this.plan.plan, event.previousIndex, end);
|
|
|
|
|
this.scrollToEnd();
|
|
|
|
|
return this.plan.plan.length;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|