コード例 #1
0
var __getTensor = function (params) {
  if (!params.tensor) {
    params.tensor = Tensor.fromProduct(params.product);
  }

  return params.tensor;
};
コード例 #2
0
MomentTensorPage.prototype.getDetailsContent = function (product) {
  var tensor = Tensor.fromProduct(product),
      el = document.createElement('div'),
      author;

  this._product = product;

  author = product.properties['beachball-source'] || product.source;

  // set layout
  el.className = 'tensor-detail';
  el.innerHTML = [
    this._getTitle(tensor),
    '<div class="row clearfix">',
      '<div class="column two-of-five">',
        this._getInfo(tensor),
        this._getPlanes(tensor),
      '</div>',
      '<div class="column three-of-five beachball"></div>',
    '</div>',
    this._getAxes(tensor)
  ].join('');

  // add beachball
  el.querySelector('.beachball').appendChild(
      new BeachBall({
        tensor: tensor,
        size: 320,
        fillColor: tensor.fillColor,
        labelAxes: true,
        labelPlanes: true
      }).getCanvas());

  return el;
};