mxcube / mxcubeweb

MXCuBE-Web
http://mxcube.github.io/mxcubeweb/
GNU Lesser General Public License v3.0
25 stars 39 forks source link

Store sampleview coords in context menu state #1489

Closed axelboc closed 2 weeks ago

axelboc commented 3 weeks ago

I now store e.offset<X|Y> / imageRatio instead of just e.offset<X|Y> in the state, which saves ContextMenu from having to do this calculation in a couple of places.

I've made a couple of additional commits to move some logic around, inline some methods, etc., and to let the right-clicked shape be undefined in the state (instead of storing a fake shape object { type: 'NONE' }).

axelboc commented 3 weeks ago

Replacing the dummy shape { type: 'NONE' } with undefined in the context menu state seems to have caused some issues in the showModal method. Apologies, I'll investigate.

axelboc commented 3 weeks ago

I've used optional chaining in showModal to handle an undefined shape. In the other methods, the shape prop is always defined.