Sha256: 222b0d2aae9082ac941a933433bcb7c634cd8d0c8956b88b75c4f8a370634ce0

Contents?: true

Size: 1.23 KB

Versions: 12

Compression:

Stored size: 1.23 KB

Contents

<!-- Take inputs from page front matter and calculate the coordinates of the svg elements -->
{% assign image_handle = include.image_handle %}

{% if page[image_handle].augment %}

  <!-- get image dimensions -->
  {%- assign imageX = page[image_handle].augment.image | split: ', ' | first -%}
  {%- assign imageY = page[image_handle].augment.image | split: ', ' | last -%}

  <!-- pre-assign arrays for circle centers and line ends -->
  {% assign cX = '' | split: ',' %}
  {% assign cY = '' | split: ',' %}

  <!-- loop over all the requested labels -->
  {% for item in page[image_handle].augment.labels %}

    <!-- x(i) and y(i) -->
    {% assign ix = item.coord | split: ', ' | first %}
    {% assign iy = item.coord | split: ', ' | last %}

    <!-- calculate circle centers as percentage of image size -->
    {% assign cx = ix | times: 100 | divided_by: imageX | append: ', ' %}
    {% assign cy = iy | times: 100 | divided_by: imageY | append: ', ' %}
    <!-- push into arrays -->
    {% assign cX = cX | push: cx %}
    {% assign cY = cY | push: cy %}

  {% endfor %}

{% endif %}

<!--
in:   [imageX, imageY] pixels
      [x, y] pixels

out:  cX = [cx_1, cx_2, ... , cx_n]
      cY = [cy_1, cy_2, ... , cy_n]

      X1 = [x1_1, x1_2, ... , x1_n]
-->

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
slow-steps-0.1.13 _includes/functions/calc-svg-coord.html
slow-steps-0.1.12 _includes/functions/calc-svg-coord.html
slow-steps-0.1.11 _includes/functions/calc-svg-coord.html
slow-steps-0.1.10 _includes/functions/calc-svg-coord.html
slow-steps-0.1.9 _includes/functions/calc-svg-coord.html
slow-steps-0.1.8 _includes/functions/calc-svg-coord.html
slow-steps-0.1.7 _includes/functions/calc-svg-coord.html
slow-steps-0.1.6 _includes/functions/calc-svg-coord.html
slow-steps-0.1.5 _includes/functions/calc-svg-coord.html
slow-steps-0.1.4 _includes/functions/calc-svg-coord.html
slow-steps-0.1.3 _includes/functions/calc-svg-coord.html
slow-steps-0.1.2 _includes/functions/calc-svg-coord.html