Comparing version 1.3.0 to 1.4.0
# History | ||
---- | ||
## 1.4.0 | ||
- only flip if it's visible | ||
## 1.1.0 | ||
@@ -5,0 +10,0 @@ |
@@ -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": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36447
848
7