# Buggy code
def _on_highlight_change(self, event=None):
    if self.layer.dims.ndisplay == 3:
        return

    if len(self.layer._highlight_index) > 0:
        # Color the hovered or selected points
        data = self.layer._data_view[self.layer._highlight_index]
        if data.ndim == 1:
            data = np.expand_dims(data, axis=0)
        size = self.layer._size_view[self.layer._highlight_index]
        face_color = self.layer.face_color[
            self.layer._indices_view[self.layer._highlight_index]
        ]
    else:
        data = np.zeros((1, self.layer.dims.ndisplay))
        size = 0
        face_color = np.array([[1.0, 1.0, 1.0, 1.0]], dtype=np.float32)

    self.node._subvisuals[1].set_data(
        data[:, ::-1] + 0.5,
        size=size,
        edge_width=self._highlight_width,
        symbol=self.layer.symbol,
        edge_color=self._highlight_color,
        face_color=face_color,
        scaling=True,
    )

    if self.layer._highlight_box is None or 0 in self.layer._highlight_box.shape:
        pos = np.zeros((1, self.layer.dims.ndisplay))
        width = 0
    else:
        pos = self.layer._highlight_box
        width = self._highlight_width

    self.node._subvisuals[2].set_data(
        pos=pos[:, ::-1] + 0.5, color=self._highlight_color, width=width
    )


# Traceback (ValueError)
WARNING: Traceback (most recent call last):
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/_qt/qt_viewer_buttons.py", line 173, in <lambda>
lambda state=self: self.change_ndisplay(state)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/_qt/qt_viewer_buttons.py", line 178, in change_ndisplay
self.viewer.dims.ndisplay = 3
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/components/dims.py", line 296, in ndisplay
self.events.ndisplay()
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 508, in __call__
self._invoke_callback(cb, event)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 529, in _invoke_callback
cb_event=(cb, event),
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 523, in _invoke_callback
cb(event)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/components/viewer_model.py", line 88, in <lambda>
self.dims.events.ndisplay.connect(lambda e: self._update_layers())
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/components/viewer_model.py", line 1037, in _update_layers
layer.dims.ndisplay = self.dims.ndisplay
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/components/dims.py", line 296, in ndisplay
self.events.ndisplay()
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 508, in __call__
self._invoke_callback(cb, event)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 529, in _invoke_callback
cb_event=(cb, event),
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 523, in _invoke_callback
cb(event)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/base/base.py", line 180, in <lambda>
self.dims.events.ndisplay.connect(lambda e: self._update_dims())
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/base/base.py", line 383, in _update_dims
self.refresh()
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/base/base.py", line 600, in refresh
self._set_view_slice()
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/points/points.py", line 654, in _set_view_slice
self._selected_box = self.interaction_box(self._selected_view)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/points/points.py", line 480, in interaction_box
data = points_to_squares(data, size)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/points/points.py", line 972, in points_to_squares
points + np.sqrt(2) / 2 * np.array([sizes, sizes]).T,
ValueError: operands could not be broadcast together with shapes (1,3) (1,2)
WARNING:vispy:Traceback (most recent call last):
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/_qt/qt_viewer_buttons.py", line 173, in <lambda>
lambda state=self: self.change_ndisplay(state)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/_qt/qt_viewer_buttons.py", line 178, in change_ndisplay
self.viewer.dims.ndisplay = 3
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/components/dims.py", line 296, in ndisplay
self.events.ndisplay()
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 508, in __call__
self._invoke_callback(cb, event)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 529, in _invoke_callback
cb_event=(cb, event),
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 523, in _invoke_callback
cb(event)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/components/viewer_model.py", line 88, in <lambda>
self.dims.events.ndisplay.connect(lambda e: self._update_layers())
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/components/viewer_model.py", line 1037, in _update_layers
layer.dims.ndisplay = self.dims.ndisplay
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/components/dims.py", line 296, in ndisplay
self.events.ndisplay()
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 508, in __call__
self._invoke_callback(cb, event)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 529, in _invoke_callback
cb_event=(cb, event),
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/utils/event.py", line 523, in _invoke_callback
cb(event)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/base/base.py", line 180, in <lambda>
self.dims.events.ndisplay.connect(lambda e: self._update_dims())
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/base/base.py", line 383, in _update_dims
self.refresh()
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/base/base.py", line 600, in refresh
self._set_view_slice()
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/points/points.py", line 654, in _set_view_slice
self._selected_box = self.interaction_box(self._selected_view)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/points/points.py", line 480, in interaction_box
data = points_to_squares(data, size)
File "/home/hagai/.conda/envs/ncd/lib/python3.7/site-packages/napari/layers/points/points.py", line 972, in points_to_squares
points + np.sqrt(2) / 2 * np.array([sizes, sizes]).T,
ValueError: operands could not be broadcast together with shapes (1,3) (1,2)

# Fixed code
def _on_highlight_change(self, event=None):
    if len(self.layer._highlight_index) > 0:
        # Color the hovered or selected points
        data = self.layer._data_view[self.layer._highlight_index]
        if data.ndim == 1:
            data = np.expand_dims(data, axis=0)
        size = self.layer._size_view[self.layer._highlight_index]
    else:
        data = np.zeros((1, self.layer.dims.ndisplay))
        size = 0

    self.node._subvisuals[1].set_data(
        data[:, ::-1] + 0.5,
        size=size,
        edge_width=self._highlight_width,
        symbol=self.layer.symbol,
        edge_color=self._highlight_color,
        face_color=transform_color("transparent"),
        scaling=True,
    )

    # only draw a box in 2D
    if self.layer.dims.ndisplay == 2:
        if self.layer._highlight_box is None or 0 in self.layer._highlight_box.shape:
            pos = np.zeros((1, self.layer.dims.ndisplay))
            width = 0
        else:
            pos = self.layer._highlight_box
            width = self._highlight_width

        self.node._subvisuals[2].set_data(
            pos=pos[:, ::-1] + 0.5,
            color=self._highlight_color,
            width=width,
        )

    self.node.update()