How to use the basis.dom.computedStyle.get function in basis

To help you get started, we’ve selected a few basis 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 basisjs / basisjs / src / basis / ui / resizer.js View on Github external
dragData.delta = PROPERTY_DELTA[this.property];
      dragData.factor = this.factor;

      // determine dir
      var cssFloat = computedStyle(this.element, 'float');
      var cssPosition = computedStyle(this.element, 'position');

      var relToOffsetParent = cssPosition == 'absolute' || cssPosition == 'fixed';
      var parentNode = relToOffsetParent ? this.element.offsetParent || document.body : this.element.parentNode;
      var parentNodeSize;

      if (dragData.delta == 'deltaY')
      {
        dragData.offsetStart = this.element.clientHeight
          - parseFloat(computedStyle(this.element, 'padding-top'))
          - parseFloat(computedStyle(this.element, 'padding-bottom'));

        parentNodeSize = parentNode.clientHeight;
        if (!relToOffsetParent)
          parentNodeSize -= parseFloat(computedStyle(parentNode, 'padding-top')) + parseFloat(computedStyle(parentNode, 'padding-bottom'));

        if (isNaN(dragData.factor))
          dragData.factor = -(relToOffsetParent && computedStyle(this.element, 'bottom') != 'auto') || 1;
      }
      else
      {
        dragData.offsetStart = this.element.clientWidth
          - parseFloat(computedStyle(this.element, 'padding-left'))
          - parseFloat(computedStyle(this.element, 'padding-right'));

        parentNodeSize = parentNode.clientWidth;
        if (!relToOffsetParent)
github basisjs / basisjs / src / basis / ui / resizer.js View on Github external
emit_start: function(dragData, event){
      super_.emit_start.call(this, dragData, event);

      cursorOverrideRule.setProperty('cursor', this.cursor + ' !important');

      dragData.delta = PROPERTY_DELTA[this.property];
      dragData.factor = this.factor;

      // determine dir
      var cssFloat = computedStyle(this.element, 'float');
      var cssPosition = computedStyle(this.element, 'position');

      var relToOffsetParent = cssPosition == 'absolute' || cssPosition == 'fixed';
      var parentNode = relToOffsetParent ? this.element.offsetParent || document.body : this.element.parentNode;
      var parentNodeSize;

      if (dragData.delta == 'deltaY')
      {
        dragData.offsetStart = this.element.clientHeight
          - parseFloat(computedStyle(this.element, 'padding-top'))
          - parseFloat(computedStyle(this.element, 'padding-bottom'));

        parentNodeSize = parentNode.clientHeight;
        if (!relToOffsetParent)
          parentNodeSize -= parseFloat(computedStyle(parentNode, 'padding-top')) + parseFloat(computedStyle(parentNode, 'padding-bottom'));

        if (isNaN(dragData.factor))
github basisjs / basisjs / src / basis / tracker.js View on Github external
function isVisible(element){
    if (getComputedStyle(element, 'visibility') != 'visible')
      return false;

    var box = getBoundingRect(element);

    if (!box.width || !box.height)
      return false;

    return true;
  }
github basisjs / basisjs / src / basis / ui / resizer.js View on Github external
var cssFloat = computedStyle(this.element, 'float');
      var cssPosition = computedStyle(this.element, 'position');

      var relToOffsetParent = cssPosition == 'absolute' || cssPosition == 'fixed';
      var parentNode = relToOffsetParent ? this.element.offsetParent || document.body : this.element.parentNode;
      var parentNodeSize;

      if (dragData.delta == 'deltaY')
      {
        dragData.offsetStart = this.element.clientHeight
          - parseFloat(computedStyle(this.element, 'padding-top'))
          - parseFloat(computedStyle(this.element, 'padding-bottom'));

        parentNodeSize = parentNode.clientHeight;
        if (!relToOffsetParent)
          parentNodeSize -= parseFloat(computedStyle(parentNode, 'padding-top')) + parseFloat(computedStyle(parentNode, 'padding-bottom'));

        if (isNaN(dragData.factor))
          dragData.factor = -(relToOffsetParent && computedStyle(this.element, 'bottom') != 'auto') || 1;
      }
      else
      {
        dragData.offsetStart = this.element.clientWidth
          - parseFloat(computedStyle(this.element, 'padding-left'))
          - parseFloat(computedStyle(this.element, 'padding-right'));

        parentNodeSize = parentNode.clientWidth;
        if (!relToOffsetParent)
          parentNodeSize -= parseFloat(computedStyle(parentNode, 'padding-left')) + parseFloat(computedStyle(parentNode, 'padding-right'));

        if (isNaN(dragData.factor))
        {
github basisjs / basisjs / src / basis / ui / panel.js View on Github external
function getHeight(element){
    return element.clientHeight
      - parseInt(computedStyle(element, 'padding-top'))
      - parseInt(computedStyle(element, 'padding-bottom'));
  }
github basisjs / basisjs / src / devpanel / inspector / grid.js View on Github external
processNode: function(domNode, context){
    if (domNode.nodeType == 3)
      this.highlight(domNode, {
        gridOffset: context.offset,
        gridSize: context.size,
        baseline: getBaseline(domNode)
      });

    if (domNode.nodeType == 1 && domNode.tagName == 'INPUT' && domNode.type != 'file')
      this.highlight(domNode, {
        gridOffset: context.offset,
        gridSize: context.size,
        baseline: getBaseline(domNode)
          + parseInt(getComputedStyle(domNode, 'padding-bottom'))
          //+ parseInt(getComputedStyle(domNode, 'border-bottom-width'))
      });
  }
});
github basisjs / basisjs / src / basis / ui / resizer.js View on Github external
- parseFloat(computedStyle(this.element, 'padding-left'))
          - parseFloat(computedStyle(this.element, 'padding-right'));

        parentNodeSize = parentNode.clientWidth;
        if (!relToOffsetParent)
          parentNodeSize -= parseFloat(computedStyle(parentNode, 'padding-left')) + parseFloat(computedStyle(parentNode, 'padding-right'));

        if (isNaN(dragData.factor))
        {
          if (cssFloat == 'right')
            dragData.factor = -1;
          else
            if (cssFloat == 'left')
              dragData.factor = 1;
            else
              dragData.factor = -(relToOffsetParent && computedStyle(this.element, 'right') != 'auto') || 1;
        }
      }

      dragData.offsetStartInPercent = 100 / parentNodeSize;
      classList(this.resizer).add('selected');
    },
    emit_drag: function(dragData, event){
github basisjs / basisjs / src / basis / dom / resize.js View on Github external
var init = function(){
        if (getComputedStyle(element, 'position') == 'static')
          element.style.position = 'relative';

        var document = sensor.contentDocument;
        var win = document.defaultView || document.parentWindow;
        win.onresize = handler;
        win.document.body.onresize = handler;

        handler();
      };
github basisjs / basisjs / src / basis / ui / resizer.js View on Github external
dragData.offsetStart = this.element.clientHeight
          - parseFloat(computedStyle(this.element, 'padding-top'))
          - parseFloat(computedStyle(this.element, 'padding-bottom'));

        parentNodeSize = parentNode.clientHeight;
        if (!relToOffsetParent)
          parentNodeSize -= parseFloat(computedStyle(parentNode, 'padding-top')) + parseFloat(computedStyle(parentNode, 'padding-bottom'));

        if (isNaN(dragData.factor))
          dragData.factor = -(relToOffsetParent && computedStyle(this.element, 'bottom') != 'auto') || 1;
      }
      else
      {
        dragData.offsetStart = this.element.clientWidth
          - parseFloat(computedStyle(this.element, 'padding-left'))
          - parseFloat(computedStyle(this.element, 'padding-right'));

        parentNodeSize = parentNode.clientWidth;
        if (!relToOffsetParent)
          parentNodeSize -= parseFloat(computedStyle(parentNode, 'padding-left')) + parseFloat(computedStyle(parentNode, 'padding-right'));

        if (isNaN(dragData.factor))
        {
          if (cssFloat == 'right')
            dragData.factor = -1;
          else
            if (cssFloat == 'left')
              dragData.factor = 1;
            else
              dragData.factor = -(relToOffsetParent && computedStyle(this.element, 'right') != 'auto') || 1;
        }
      }
github basisjs / basisjs / src / basis / dragdrop.js View on Github external
read: function(element){
      return parseFloat(getComputedStyle(element, this.property));
    },
    write: function(element, formattedValue){