docs: def cal_frame_according_boundaries(left, right, top, bottom, parent_size, gaphas_editor=True, group=True):
      """ Generate margin and relative position and size handed boundary parameter and parent size """
      # print("parent_size ->", parent_size)
      margin = cal_margin(parent_size)
      # Add margin and ensure that the upper left corner is within the state
      if group:
          # frame of grouped state
          rel_pos = max(left - margin, 0), max(top - margin, 0)
          # Add margin and ensure that the lower right corner is within the state
          size = (min(right - left + 2 * margin, parent_size[0] - rel_pos[0]),
                  min(bottom - top + 2 * margin, parent_size[1] - rel_pos[1]))
      else:
          # frame inside of state
          # rel_pos = max(margin, 0), max(margin, 0)
          rel_pos = left, top
          size = right - left, bottom - top
  
      return margin, rel_pos, size