TodePond / Arroost

arrows in arrows in arrows
https://arroost.com
MIT License
111 stars 7 forks source link

a problem with deleting color or wires #276

Closed mahdoosh1 closed 9 months ago

mahdoosh1 commented 10 months ago

https://github.com/TodePond/Arroost/assets/83725163/4100d7ce-6a8e-4a1c-9c8b-6d53eccb1b0d

<.!-- Error while uploading 20231223_192405_es_edited.mp4 ->

mahdoosh1 commented 10 months ago

https://github.com/TodePond/Arroost/assets/83725163/0856b357-a473-48f7-8926-78eaa00d5384

@TodePond a problem in your code.

dddffgghjjjgrwwgh

TodePond commented 10 months ago

can you explain what is happening and what you expect to happen? and can you list out steps to reproduce the bug(s)

mahdoosh1 commented 10 months ago

can you explain what is happening and what you expect to happen? and can you list out steps to reproduce the bug(s)

after some wiring and changing wire color, and deleting color and wires, targeted node gets indistructable as been shown in second video

also once in a time i tryed similer thing and site just crashed (kinda) i could delete some nodes and wires but wires connected to node that i tried deleting didnt delete.

mahdoosh1 commented 10 months ago

expected: a node can't be indistructable so it shouldn't. deleting a color(square in mid) should not affect anything other than its connections (if a wire is attached to it)

mahdoosh1 commented 10 months ago

https://github.com/TodePond/Arroost/assets/83725163/0856b357-a473-48f7-8926-78eaa00d5384

@TodePond a problem in your code.

dddffgghjjjgrwwgh

random strange things also shouldnt happen as shown in middle of video

nodes shouldnt vanish

mahdoosh1 commented 10 months ago

i am also using external mouse connected to my phone

TodePond commented 10 months ago

Is anything appearing in the console when this happens?

Also, it would be great to have some simple steps I can follow to reproduce this.

something like:

  1. Open arroost.
  2. Click screen to get rid of title.
  3. Click on 'plus cell'.
  4. Click on empty space.
  5. Click... etc.

(obviously replace with whatever the steps are)

mahdoosh1 commented 10 months ago

Is anything appearing in the console when this happens?

Also, it would be great to have some simple steps I can follow to reproduce this.

something like:

  1. Open arroost.
  2. Click screen to get rid of title.
  3. Click on 'plus cell'.
  4. Click on empty space.
  5. Click... etc.

(obviously replace with whatever the steps are)

i dont have access to console since this is chrome, i have another app that will show everything you need. i will record in it later.

here are steps:

there will be a photo here:

mahdoosh1 commented 10 months ago

Screenshot_2023-12-31-15-37-47-685_com.code_element.vipapp.newapp.jpg

Screenshot_2023-12-31-15-39-14-446_com.code_element.vipapp.newapp.jpg

anderium commented 9 months ago

https://github.com/TodePond/Arroost/assets/33520919/1eaa7a5b-067b-4b32-bb7f-e518370be044

Presumably this is a simpler reproduction of the same bug. The error is raised here: https://github.com/TodePond/Arroost/blob/56eb5cba6acfaa26c1b1b1fb8915b2ff7dd738fc/source/arroost/components/tunnel.js#L233-L242

Uncaught (in promise) Error: Tunnel: Can't find tunnel 8 to delete
    at Tunnel.delete (tunnel.js:235:22)
    at Tunnel.dispose (tunnel.js:256:16)
    at ArrowOfColour.dispose (entity.js:54:14)
    at ArrowOfTime.dispose (entity.js:54:14)
    at binned (tunnel.js:392:17)
    at Tunnel.applyOperation (tunnel.js:74:3)
    at Tunnel.applyOperations (tunnel.js:64:11)
    at Tunnel.apply (tunnel.js:84:10)
    at Tunnel.perform (tunnel.js:94:50)
    at ArrowOfDestruction.onTargetingPointerUp (destruction.js:142:10)

My guess is that the ordering is messed up which causes the ArrowOfColour to be selected instead of the ArrowOfTime. Then, because only part of the arrow is deleted it fails to find all components of the ArrowOfTime when deleting that. The error that occurs presumably cascades and leaves dangling components everywhere.


Alright, looked around the code a bit—which is lovely by the way—and found what should probably solve it. For the ArrowOfTiming, you specifically remove the wire when deleting the cell. So in the ArrowOfDestruction the following code should be duplicated for the ArrowOfColour. https://github.com/TodePond/Arroost/blob/56eb5cba6acfaa26c1b1b1fb8915b2ff7dd738fc/source/arroost/entities/arrows/destruction.js#L149-L152

I.e. by changing this to:

if (cell.type === "timing" || cell.type === "colour") {
    const wire = getWire(shared.nogan, cell.wire)
    return deleteWire(shared.nogan, wire.id)
}