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

dom-align

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-align - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

5

HISTORY.md
# History
----
## 1.4.0
- only flip if it's visible
## 1.1.0

@@ -5,0 +10,0 @@

36

lib/index.js

@@ -48,2 +48,10 @@ /**

function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
}
function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
}
function flip(points, reg, map) {

@@ -111,5 +119,4 @@ var ret = [];

if (isFailX(elFuturePos, elRegion, visibleRect)) {
fail = 1;
// 对齐位置反下
points = flip(points, /[lr]/ig, {
var newPoints = flip(points, /[lr]/ig, {
l: 'r',

@@ -119,4 +126,11 @@ r: 'l'

// 偏移量也反下
offset = flipOffset(offset, 0);
targetOffset = flipOffset(targetOffset, 0);
var newOffset = flipOffset(offset, 0);
var newTargetOffset = flipOffset(targetOffset, 0);
var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, newPoints, newOffset, newTargetOffset);
if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
fail = 1;
points = newPoints;
offset = newOffset;
targetOffset = newTargetOffset;
}
}

@@ -128,5 +142,4 @@ }

if (isFailY(elFuturePos, elRegion, visibleRect)) {
fail = 1;
// 对齐位置反下
points = flip(points, /[tb]/ig, {
var newPoints = flip(points, /[tb]/ig, {
t: 'b',

@@ -136,4 +149,11 @@ b: 't'

// 偏移量也反下
offset = flipOffset(offset, 1);
targetOffset = flipOffset(targetOffset, 1);
var newOffset = flipOffset(offset, 1);
var newTargetOffset = flipOffset(targetOffset, 1);
var newElFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, newPoints, newOffset, newTargetOffset);
if (!isCompleteFailY(newElFuturePos, elRegion, visibleRect)) {
fail = 1;
points = newPoints;
offset = newOffset;
targetOffset = newTargetOffset;
}
}

@@ -140,0 +160,0 @@ }

{
"name": "dom-align",
"version": "1.3.0",
"version": "1.4.0",
"description": "Align DOM Node Flexibly ",

@@ -43,3 +43,4 @@ "keywords": [

"rc-tools": "4.x",
"react": "^0.13.0"
"react": "15.x",
"react-dom": "15.x"
},

@@ -46,0 +47,0 @@ "pre-commit": [

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