How to use the dojo/dom-geometry.getMarginBox function in dojo

To help you get started, we’ve selected a few dojo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Saleslogix / argos-saleslogix / src / Views / Charts / GenericBar.js View on Github external
});

    const data = {
      labels,
      datasets: [{
        label: 'Default',
        fillColor: this.barColor,
        data: seriesData,
      }],
    };

    if (this.chart) {
      this.chart.destroy();
    }

    const box = domGeo.getMarginBox(this.domNode);
    this.contentNode.width = box.w;
    this.contentNode.height = box.h;

    const ctx = this.contentNode.getContext('2d');

    this.chart = new window.Chart(ctx).Bar(data, this.chartOptions); // eslint-disable-line
  },
});
github Saleslogix / argos-saleslogix / src / Views / Charts / GenericPie.js View on Github external
this.showSearchExpression();

    const data = array.map(rawData, (item, idx) => {
      return {
        value: Math.round(item.value),
        color: this._getItemColor(idx),
        highlight: '',
        label: item.name,
      };
    });

    if (this.chart) {
      this.chart.destroy();
    }

    const box = domGeo.getMarginBox(this.domNode);
    this.contentNode.width = box.w;
    this.contentNode.height = box.h;

    const ctx = this.contentNode.getContext('2d');

    const chart = new window.Chart(ctx);

    // Ensure the chart has the ability to render this type
    this.renderAs = window.Chart.types.hasOwnProperty(this.renderAs) ? this.renderAs : defaultRenderAs;

    this.chart = chart[this.renderAs](data, this.chartOptions);
    this.showLegend();
  },
  _getItemColor: function _getItemColor(index) {
github ibm-js / deliteful / tests / unit / LinearLayout-direction.js View on Github external
"Horizontal LinearLayout 3 Equal Width": function () {
				var children = node.getChildren();
				assert.strictEqual(children.length, 3);
				var box1 = domGeom.getMarginBox(children[0]);
				var box2 = domGeom.getMarginBox(children[1]);
				var box3 = domGeom.getMarginBox(children[2]);
				assert.strictEqual(box1.w, 333, "box1.w");
				assert.strictEqual(box2.w, 333, "box2.w");
				assert.strictEqual(box3.w, 333, "box3.w");
			},
github ibm-js / deliteful / tests / unit / LinearLayout-vertical.js View on Github external
"Vertical LinearLayout Children Equal Size": function () {
				var children = node2.getChildren();
				var box1 = domGeom.getMarginBox(children[0]);
				var box2 = domGeom.getMarginBox(children[1]);
				assert.strictEqual(box1.h, 250, "box1");
				assert.strictEqual(box2.h, 250, "box2");
			}
		},
github ibm-js / deliteful / tests / unit / SidePane.js View on Github external
"Size Computation": function () {
				var box = domGeom.getMarginBox(node);
				assert.isTrue(box.w > 0);
				assert.isTrue(box.h > 0);
			},
github ibm-js / deliteful / tests / unit / LinearLayout-direction.js View on Github external
"Horizontal LinearLayout 3 Equal Width": function () {
				var children = node.getChildren();
				assert.strictEqual(children.length, 3);
				var box1 = domGeom.getMarginBox(children[0]);
				var box2 = domGeom.getMarginBox(children[1]);
				var box3 = domGeom.getMarginBox(children[2]);
				assert.strictEqual(box1.w, 333, "box1.w");
				assert.strictEqual(box2.w, 333, "box2.w");
				assert.strictEqual(box3.w, 333, "box3.w");
			},
github ibm-js / deliteful / tests / unit / LinearLayout-horizontal-mixedwidth.js View on Github external
"Horizontal LinearLayout Various Width": function () {
				var children = node.getChildren();
				assert.strictEqual(children.length, 3);
				var box1 = domGeom.getMarginBox(children[0]);
				var box2 = domGeom.getMarginBox(children[1]);
				var box3 = domGeom.getMarginBox(children[2]);
				assert.strictEqual(box1.w, 40, "box1.w");
				assert.strictEqual(box2.w, 600, "box2.w");
				assert.strictEqual(box3.w, 40, "box3.w");
			}
		},
github ibm-js / deliteful / tests / unit / LinearLayout-horizontal.js View on Github external
"Horizontal LinearLayout Fill Width": function () {
				var children = node.getChildren();
				assert.strictEqual(children.length, 2);
				var box1 = domGeom.getMarginBox(children[0]);
				assert.strictEqual(box1.w, 470);
			},
github Saleslogix / argos-saleslogix / src / Views / Charts / _ChartMixin.js View on Github external
_setCanvasWidth: function _setCanvasWidth() {
    const box = domGeo.getMarginBox(this.domNode);
    if (this.contentNode) {
      this.contentNode.width = box.w;
    }
  },
  _drawLoading: function _drawLoading() {
github Saleslogix / argos-saleslogix / src / Views / Attachment / ViewAttachment.js View on Github external
renderPdfPage: function renderPdfPage(pageNumber) {
    if (pageNumber < 1 || this.pdfDoc === null) {
      return;
    }

    if (pageNumber > this.pdfDoc.numPages) {
      return;
    }

    if (this.pdfIsLoading) {
      return;
    }

    const box = domGeo.getMarginBox(this.domNode);
    this.pdfDoc.getPage(pageNumber).then((page) => {
      const scale = this.pdfScale;
      let viewport = page.getViewport(scale);
      const canvas = document.getElementById('pdfViewer');
      const context = canvas.getContext('2d');
      const desiredWidth = box.w;
      viewport = page.getViewport(desiredWidth / viewport.width);
      canvas.height = viewport.height < box.h ? box.h : viewport.height;
      canvas.width = viewport.width;

      const renderContext = {
        canvasContext: context,
        viewport,
      };

      this.pdfIsLoading = true;

dojo

Dojo core is a powerful, lightweight library that makes common tasks quicker and easier. Animate elements, manipulate the DOM, and query with easy CSS syntax, all without sacrificing performance.

BSD-3-Clause OR AFL-2.1
Latest version published 2 years ago

Package Health Score

60 / 100
Full package analysis