Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aligner

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aligner - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

30

index.js
var mucss = require('mucss');
var m = require('mumath');
/**

@@ -80,9 +80,14 @@ * @module

//get relativeTo & parent rectangles
var parent = placee.offsetParent || win;
var parent = placee.offsetParent;
var parentRect = css.offsets(parent);
var parentPaddings = css.paddings(parent);
var parentBorders = css.borders(parent);
//correct parentRect
if (parent === doc.body || parent === root && getComputedStyle(parent).position === 'static') {
parentRect.left = 0;
}
//desirable absolute left
var desirableAbsLeft = placerRect.left + placerRect.width*align - placeeWidth*align;
var desirableLeft = desirableAbsLeft - parentRect.left - placeeMargins.left - parentPaddings.left;
var desirableLeft = placerRect.left + placerRect.width*align - placeeWidth*align + parentBorders.left - parentRect.left - placeeMargins.left - parentPaddings.left;

@@ -108,9 +113,14 @@ css(placee, {

//get relativeTo & parent rectangles
var parent = placee.offsetParent || win;
var parent = placee.offsetParent ;
var parentRect = css.offsets(parent);
var parentPaddings = css.paddings(parent);
var parentBorders = css.borders(parent);
//correct parentRect
if (parent === doc.body || parent === root && getComputedStyle(parent).position === 'static') {
parentRect.top = 0;
}
//desirable absolute top
var desirableAbsTop = placerRect.top + placerRect.height*align - placeeHeight*align;
var desirableTop = desirableAbsTop - parentRect.top - placeeMargins.top - parentPaddings.top;
var desirableTop = placerRect.top + placerRect.height*align - placeeHeight*align + parentBorders.top - parentRect.top - placeeMargins.top - parentPaddings.top;

@@ -129,4 +139,2 @@ css(placee, {

function numerify(value){
if (!value) return 0;
if (typeof value === 'string') {

@@ -145,6 +153,6 @@ //else parse single-value

}
return parseFloat(value);
}
var num = parseFloat(value);
return num !== undefined ? num : 0.5;
return value;
}
{
"name": "aligner",
"version": "0.0.2",
"version": "0.0.3",
"description": "Align DOM elements",

@@ -22,3 +22,6 @@ "main": "index.js",

},
"homepage": "https://github.com/dfcreative/aligner"
"homepage": "https://github.com/dfcreative/aligner",
"dependencies": {
"mumath": "~0.2.0"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc