public override void OnGridClick(Tuple <int, int, Editor.ClickPosition> infos) { QCS.Circuit.GateStruct gateStruct = _selectedGate.gateStruct; int sourceRow = gateStruct.row; int sourceCol = gateStruct.col; int nbEntries = gateStruct.gate.NbEntries; int targetRow = infos.Item1; int targetCol = infos.Item2; Editor.ClickPosition position = infos.Item3; if (nbEntries % 2 == 0 && (position == Editor.ClickPosition.TopLeft || position == Editor.ClickPosition.BotLeft)) { targetCol -= nbEntries / 2; } else { targetCol -= (nbEntries - 1) / 2; } if (targetCol < 0) { targetCol = 0; } Debug.Log("MoveGate to (" + targetRow + ", " + targetCol + ")"); context.currentCircuit.MoveGate(sourceRow, sourceCol, targetRow, targetCol); context.CurrentState = _previousState; }
public override void OnGridClick(Tuple <int, int, Editor.ClickPosition> infos) { int targetRow = infos.Item1; Editor.ClickPosition position = infos.Item3; if (position == Editor.ClickPosition.BotLeft || position == Editor.ClickPosition.BotRight) { targetRow++; } Debug.Log("MoveCol to " + infos + " = " + targetRow); if (_sourceRow < targetRow) { targetRow--; } context.currentCircuit.MoveRow(_sourceRow, targetRow); context.CurrentState = _previousState; }
public override void OnGridClick(Tuple <int, int, Editor.ClickPosition> infos) { int targetCol = infos.Item2; Editor.ClickPosition position = infos.Item3; if (position == Editor.ClickPosition.TopRight || position == Editor.ClickPosition.BotRight) { targetCol++; } Debug.Log("MoveCol to " + infos + " = " + targetCol); if (_sourceCol < targetCol) { targetCol--; Debug.Log("MoveCol, source is lesser then, to " + targetCol); } context.currentCircuit.MoveCol(_sourceCol, targetCol); context.CurrentState = _previousState; }