Skip to content

Commit

Permalink
wip: implement some working mechanism for ActionBlockLayerView
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxGalaxy committed Jan 7, 2025
1 parent 7a46e4c commit 1cdb707
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import com.icst.logic.editor.event.LogicEditorEventListener;
import com.icst.logic.lib.config.LogicEditorConfiguration;
import com.icst.logic.lib.view.ActionBlockDropZoneView;
import com.icst.logic.lib.view.ActionBlockLayerView;
import com.icst.logic.lib.view.BlockDropZoneView;
import com.icst.logic.lib.view.DraggingBlockDummy;
import com.icst.logic.lib.view.MainActionBlockDropZoneView;
Expand Down Expand Up @@ -334,6 +335,13 @@ public void resetFromDragging() {
for (int i = index; i < regularChain.getChildCount(); ++i) {
regularChain.getChildAt(i).setVisibility(View.VISIBLE);
}
} else if (actionBlockBeanView.getParent().getParent() != null) {
if (actionBlockBeanView.getParent().getParent() instanceof ActionBlockLayerView regularChain) {
index = regularChain.getBlockLayout().indexOfChild(actionBlockBeanView);
for (int i = index; i < regularChain.getBlocksSize(); ++i) {
regularChain.getBlockLayout().getChildAt(i).setVisibility(View.VISIBLE);
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public int getIndex(float x, float y) {
// Configured for ActionBlockLayerView
@Override
protected void addBlockBeans(ArrayList<ActionBlockBean> actionBlocks, int index) {
this.getBlockBeans().addAll(index, actionBlocks);
getBlockBeans().addAll(index, actionBlocks);

for (int i = 0; i < actionBlocks.size(); ++i) {
ActionBlockBean actionBlock = actionBlocks.get(i);
Expand Down Expand Up @@ -204,4 +204,8 @@ public void setLayerPosition(int layerPosition) {
public ActionBlockLayerView getView() {
return this;
}

public LinearLayout getBlockLayout() {
return this.blockLayout;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import com.icst.logic.block.view.RegularBlockBeanView;
import com.icst.logic.editor.view.LogicEditorView;
import com.icst.logic.lib.view.ActionBlockDropZoneView;
import com.icst.logic.lib.view.ActionBlockLayerView;
import com.icst.logic.lib.view.DraggingBlockDummy;
import com.icst.logic.lib.view.MainActionBlockDropZoneView;
import com.icst.logic.utils.CanvaMathUtils;
Expand Down Expand Up @@ -97,6 +98,18 @@ public void run() {
.setVisibility(View.GONE);
draggingBlocks.add(blocksList.get(i));
}
} else if (actionBlockDropZone.getParent() != null) {
if (actionBlockDropZone.getParent() instanceof ActionBlockLayerView regularChain) {
int index = regularChain
.getBlockLayout()
.indexOfChild(actionBlockBeanView);
blocksList = regularChain.getBlockBeans();

for (int i = index; i < regularChain.getBlocksSize(); ++i) {
regularChain.getBlockLayout().getChildAt(i).setVisibility(View.GONE);
draggingBlocks.add(blocksList.get(i));
}
}
}

draggingBean = draggingBlocks;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1cdb707

Please sign in to comment.