class_docstr: Base class for FigureWidget. The FigureWidget class is code-generated as a
  subclass
class_docstr_tok: ["Base","class","for","FigureWidget",".","The","FigureWidget","class","is","code-generated","as","a","subclass"]
docstr: Process trace deltas message from the frontend
docstr_tok: ["Process","trace","deltas","message","from","the","frontend"]
code: def _handler_js2py_traceDeltas(self, change):
      """
      Process trace deltas message from the frontend
      """
  
      # Receive message
      # ---------------
      msg_data = change["new"]
      if not msg_data:
          self._js2py_traceDeltas = None
          return
  
      trace_deltas = msg_data["trace_deltas"]
      trace_edit_id = msg_data["trace_edit_id"]
  
      # Apply deltas
      # ------------
      # We only apply the deltas if this message corresponds to the most
      # recent trace edit operation
      if trace_edit_id == self._last_trace_edit_id:
          # ### Loop over deltas ###
          for delta in trace_deltas:
              # #### Find existing trace for uid ###
              trace_uid = delta["uid"]
              trace_uids = [trace.uid for trace in self.data]
              trace_index = trace_uids.index(trace_uid)
              uid_trace = self.data[trace_index]
  
              # #### Transform defaults to delta ####
              delta_transform = BaseFigureWidget._transform_data(
                  uid_trace._prop_defaults, delta
              )
  
              # #### Remove overlapping properties ####
              # If a property is present in both _props and _prop_defaults
              # then we remove the copy from _props
              remove_props = self._remove_overlapping_props(
                  uid_trace._props, uid_trace._prop_defaults
              )
  
              # #### Notify frontend model of property removal ####
              if remove_props:
                  remove_trace_props_msg = {
                      "remove_trace": trace_index,
                      "remove_props": remove_props,
                  }
                  self._py2js_removeTraceProps = remove_trace_props_msg
                  self._py2js_removeTraceProps = None
  
              # #### Dispatch change callbacks ####
              self._dispatch_trace_change_callbacks(
                  delta_transform, [trace_index]
              )
  
          # ### Trace edits no longer in process ###
          self._trace_edit_in_process = False
  
          # ### Call any waiting trace edit callbacks ###
          if not self._layout_edit_in_process:
              while self._waiting_edit_callbacks:
                  self._waiting_edit_callbacks.pop()()
  
      self._js2py_traceDeltas = None
  
imports: import uuid
  from importlib import import_module
  import os
  import numbers
  import ipywidgets
  from traitlets import List, Unicode, Dict, observe, Integer
  from .basedatatypes import BaseFigure, BasePlotlyType
  from .callbacks import BoxSelector, LassoSelector, InputDeviceState, Points
  from .serializers import custom_serializers
  from .version import __frontend_version__
label_desc: Use image node_id 9 for calling the BaseFigureWidget obj's underlying member method code with example usage: obj._handler_js2py_traceDeltas(change) without return types