Sha256: caca5b7cf3aae02c44b7d6429e6a78d3815fffdc0dd11cac4a91e52a5b8dc988

Contents?: true

Size: 1.01 KB

Versions: 13

Compression:

Stored size: 1.01 KB

Contents

pageflow.linkmapPage.areaPattern = {
  applyOffset: function(canvas, left, top, width, height) {
    var el = $(canvas)

    var deltaX = left % 14;
    var deltaY = top % 14;

    el.css({
      left: -deltaX + 'px',
      top: -deltaY + 'px',
      width: width + deltaX + 'px',
      height: height + deltaY + 'px'
    }).show();

    canvas.width = el.width();
    canvas.height = el.height();
  },

  use: function(context) {
    if (!this.patternSource) {
      var rectSize = 7;

      var canvas = document.createElement('canvas');
      this.patternSource = canvas;

      canvas.width = rectSize * 2;
      canvas.height = rectSize * 2;

      var c = canvas.getContext('2d');

      c.fillStyle = '#000';
      c.fillRect(0, 0, rectSize, rectSize);
      c.fillRect(rectSize, rectSize, rectSize, rectSize);

      c.fillStyle = '#fff';
      c.fillRect(rectSize, 0, rectSize, rectSize);
      c.fillRect(0, rectSize, rectSize, rectSize);
    }

    context.fillStyle = context.createPattern(this.patternSource, 'repeat');
  }
};

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pageflow-linkmap-page-2.10.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.9.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.8.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.7.1 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.7.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.6.1 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.6.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.5.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.4.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.3.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.2.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.1.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js
pageflow-linkmap-page-2.0.0 app/assets/javascript/pageflow/linkmap_page/editor/patterns/area_pattern.js