Skip to content

Commit

Permalink
fix: move electrode out of canvas error
Browse files Browse the repository at this point in the history
  • Loading branch information
ChangChiTW committed Oct 24, 2022
1 parent 8657df0 commit c5284f6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/editor/main/Stage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ export default {
for (let i = 0; i < acEl.classes.matrix.length; i++) {
for (let j = 0; j < acEl.classes.matrix[i].length; j++) {
if (acEl.classes.matrix[i][j] !== 0) {
if (this.chip.matrix[acEl.top / unit + i][acEl.left / unit + j]) {
const y = acEl.top / unit + i
const x = acEl.left / unit + j
if (y < 0 || x < 0 || y > this.chip.matrix.length || x > this.chip.matrix[0].length || this.chip.matrix[y][x]) {
collision = true
}
}
Expand Down

0 comments on commit c5284f6

Please sign in to comment.