kaorahi / lizgoban

Leela Zero & KataGo visualizer
GNU General Public License v3.0
169 stars 28 forks source link

Selection area is canceled when selecting the main goban analysis region #113

Closed qcgm1978 closed 7 months ago

qcgm1978 commented 7 months ago

Sometimes if alt key released precedes onmouseup event when selecting an area, it will lead to idx being false in the following code that leads to cancel selection area. It is suggested to remove this condition, because defensive programming has already been done in the if statement.

const onmouseup = e => {
  if (!is_setting_analysis_region()) { return }
  const idx =
      // maybe need comment out
      is_event_to_set_analysis_region(e) &&
      mouse2idx(e, coord2idx)
  set_analysis_region(idx); hover_off(canvas)
  idx && cancel_next_alt_up()
}

I found this feature very useful when pasting images and other data, such as solving life and death problems. Maybe a tip could be added on the sgf_from_image page.

kaorahi commented 7 months ago

I'll remove is_event_to_set_analysis_region(e) there. This will be more user-friendly, as you suggested. thx!

As usual, I'll push the commit after dogfooding for a while.

For life/death problems, I recommend using Tool > Tsumego frame rather than just using the analysis region though.

qcgm1978 commented 7 months ago

The Tsumego frame functionality sometimes causes confusion. Some life and death problems are related to outside thick positions, so this feature sometimes has the opposite of the intended effect. In addition, I'm considering if there are other ways to achieve the goal. For example, holding down the Ctrl key to select an area that the AI should not consider, similar to the avoidMoves feature in Katago. Also, many examples from go books only show local positions, which can make one side overly strong on a 19x19 board and lead to unexpected AI judgements. In these cases, we could create balance by adjusting the komi.

I have already implemented the above functions locally and need some time to evaluate their effectiveness.

kaorahi commented 7 months ago

fixed