dist/axis3d.js
// Context and canvas creation helper functions
Context and canvas creation helper functions
Context and canvas creation helper functions
function createCanvas(element, onDone, pixelRatio) {
    var canvas = document.createElement('canvas');
    extend(canvas.style, {
      border: 0,
      margin: 0,
      padding: 0,
      top: 0,
      left: 0
    });
    element.appendChild(canvas);
    if (element === document.body) {
      canvas.style.position = 'absolute';
      extend(element.style, {
        margin: 0,
        padding: 0
      });
    }
    function resize() {
      var w = window.innerWidth;
      var h = window.innerHeight;
      if (element !== document.body) {
        var bounds = element.getBoundingClientRect();
        w = bounds.right - bounds.left;
        h = bounds.bottom - bounds.top;
      }
      canvas.width = pixelRatio * w;
      canvas.height = pixelRatio * h;
      extend(canvas.style, {
        width: w + 'px',
        height: h + 'px'
      });
    }
    window.addEventListener('resize', resize, false);
    function onDestroy() {
      window.removeEventListener('resize', resize);
      element.removeChild(canvas);
    }
    resize();
    return {
      canvas: canvas,
      onDestroy: onDestroy
    };
  }
function createCanvas ( element , onDone , pixelRatio ) { var canvas = document . createElement ( 'canvas' ) ; extend ( canvas . style , { border : 0 , margin : 0 , padding : 0 , top : 0 , left : 0 } ) ; element . appendChild ( canvas ) ; if ( element === document . body ) { canvas . style . position = 'absolute' ; extend ( element . style , { margin : 0 , padding : 0 } ) ; } function resize ( ) { var w = window . innerWidth ; var h = window . innerHeight ; if ( element !== document . body ) { var bounds = element . getBoundingClientRect ( ) ; w = bounds . right - bounds . left ; h = bounds . bottom - bounds . top ; } canvas . width = pixelRatio * w ; canvas . height = pixelRatio * h ; extend ( canvas . style , { width : w + 'px' , height : h + 'px' } ) ; } window . addEventListener ( 'resize' , resize , false ) ; function onDestroy ( ) { window . removeEventListener ( 'resize' , resize ) ; element . removeChild ( canvas ) ; } resize ( ) ; return { canvas : canvas , onDestroy : onDestroy } ; }
Context and canvas creation helper functions
Context and canvas creation helper functions