Commit 5e9bbcaa authored by Paul Asmuth's avatar Paul Asmuth
Browse files

improved vertical alignment of 'flowing' legend items

parent 3763e12c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ ReturnCode legend_layout_item_flow(
  double m_width = 0;
  double m_height = 0;

  size_t r_begin = item_boxes->size();
  double r_width = 0;
  double r_height = 0;
  for (const auto& e : config.items) {
@@ -154,6 +155,7 @@ ReturnCode legend_layout_item_flow(
      m_height += r_height + config.item_row_padding;
      r_width = 0;
      r_height = 0;
      r_begin = item_boxes->size();
    }

    Rectangle item_box;
@@ -169,6 +171,11 @@ ReturnCode legend_layout_item_flow(
    r_width += e_width;
    r_height = std::max(r_height, e_height);
    m_width = std::max(m_width, r_width);

    // not a problem since rows are O(10^1)
    for (size_t i = r_begin; i < item_boxes->size(); ++i) {
      item_boxes->at(i).h = r_height;
    }
  }

  *min_width = m_width;
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ void normalize(

  convert_unit_typographic(
      layer.dpi,
      config->label_font_size,
      config->marker_size,
      &config->marker_margin);
}

+2 −2
Original line number Diff line number Diff line
@@ -14,9 +14,9 @@
  <path stroke-width="1.000000" stroke="#333333" fill="none" d="M39.1111 411.156 L155.186 411.156 "/>
  <path stroke-width="1.000000" stroke="#333333" fill="none" d="M39.1111 338 L39.1111 411.156 "/>
  <text x="80.177778" y="367.644444" fill="#333333" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif">Series A</text>
  <path fill="#cccccc" d="M68.0778 362.644 M57.0778 362.644 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path fill="#cccccc" d="M67.1 362.644 M56.1 362.644 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <text x="80.177778" y="391.511111" fill="#333333" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif">Series B</text>
  <path fill="#888888" d="M68.0778 386.511 M57.0778 386.511 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path fill="#888888" d="M67.1 386.511 M56.1 386.511 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path stroke-width="1.333333" stroke="#333333" fill="none" d="M19.5556 49.2889 L1180.44 49.2889 "/>
  <path stroke-width="1.333333" stroke="#333333" fill="none" d="M19.5556 49.2889 L19.5556 54.6222 "/>
  <path stroke-width="1.333333" stroke="#333333" fill="none" d="M135.644 49.2889 L135.644 54.6222 "/>
+4 −4
Original line number Diff line number Diff line
@@ -57,13 +57,13 @@
  <path stroke-width="1.000000" stroke="#333333" fill="none" d="M84.2819 411.156 L206.889 411.156 "/>
  <path stroke-width="1.000000" stroke="#333333" fill="none" d="M84.2819 290.267 L84.2819 411.156 "/>
  <text x="125.348611" y="319.911111" fill="#333333" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif">New York</text>
  <path fill="#4572a7" d="M113.249 314.911 M102.249 314.911 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path fill="#4572a7" d="M112.271 314.911 M101.271 314.911 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <text x="125.348611" y="343.777778" fill="#333333" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif">北京市   </text>
  <path fill="#aa4643" d="M113.249 338.778 M102.249 338.778 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path fill="#aa4643" d="M112.271 338.778 M101.271 338.778 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <text x="125.348611" y="367.644444" fill="#333333" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif">Москва</text>
  <path fill="#89a54e" d="M113.249 362.644 M102.249 362.644 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path fill="#89a54e" d="M112.271 362.644 M101.271 362.644 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <text x="125.348611" y="391.511111" fill="#333333" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif">Berlin</text>
  <path fill="#80699b" d="M113.249 386.511 M102.249 386.511 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path fill="#80699b" d="M112.271 386.511 M101.271 386.511 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path stroke-width="1.333333" stroke="#333333" fill="none" d="M64.7264 430.711 L1180.44 430.711 "/>
  <path stroke-width="1.333333" stroke="#333333" fill="none" d="M119.598 425.378 L119.598 430.711 "/>
  <path stroke-width="1.333333" stroke="#333333" fill="none" d="M211.05 425.378 L211.05 430.711 "/>
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
  <path stroke-width="1.000000" stroke="#333333" fill="none" d="M84.2819 411.156 L193.842 411.156 "/>
  <path stroke-width="1.000000" stroke="#333333" fill="none" d="M84.2819 361.867 L84.2819 411.156 "/>
  <text x="125.348611" y="391.511111" fill="#333333" font-size="14.666667" font-family="Arial,Helvetica,'Helvetica Neue',sans-serif">London</text>
  <path fill="#0066cc" d="M113.249 386.511 M102.249 386.511 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path fill="#0066cc" d="M112.271 386.511 M101.271 386.511 a5.5 5.5 0 1 0 11 0 a5.5 5.5 0 1 0 -11 0 "/>
  <path stroke-width="1.333333" stroke="#333333" fill="none" d="M64.7264 430.711 L1180.44 430.711 "/>
  <path stroke-width="1.333333" stroke="#333333" fill="none" d="M119.598 425.378 L119.598 430.711 "/>
  <path stroke-width="1.333333" stroke="#333333" fill="none" d="M211.05 425.378 L211.05 430.711 "/>
Loading