adjust-engine
Advanced tools
Comparing version 2.0.3 to 2.0.4
2.0.4 / 2015-08-31 | ||
================== | ||
* simplify offsets to just being x and y. works better for flipping | ||
2.0.3 / 2015-08-31 | ||
@@ -3,0 +8,0 @@ ================== |
41
index.js
@@ -16,13 +16,2 @@ /** | ||
/** | ||
* Default offsets | ||
*/ | ||
var offsets = { | ||
bottom: 0, | ||
right: 0, | ||
left: 0, | ||
top: 0 | ||
} | ||
/** | ||
* Initialize `Adjust` | ||
@@ -44,3 +33,3 @@ * | ||
var offset = assign({}, offsets, options.offset) | ||
var offset = assign({ x: 0, y: 0 }, options.offset) | ||
var attachment = options.attachment ? expr(options.attachment) : mirror(expr(options.target)) | ||
@@ -64,6 +53,6 @@ var target = options.target ? expr(options.target) : mirror(expr(options.attachment)) | ||
// update the position with the offsets | ||
var left = target_position.left + offset_x + offset.left - offset.right | ||
var top = target_position.top + offset_y + offset.top - offset.bottom | ||
var bottom = top + height + offset.bottom - offset.top | ||
var right = left + width + offset.right - offset.left | ||
var left = target_position.left + offset_x + offset.x | ||
var top = target_position.top + offset_y + offset.y | ||
var bottom = top + height | ||
var right = left + width | ||
@@ -76,4 +65,4 @@ // check if we need to flip | ||
// flip right | ||
left = target_position.right + offset.right - offset.left | ||
right = left + width + offset.left - offset.right | ||
left = target_position.right - offset.x | ||
right = left + width | ||
orientation.x = mirror(orientation.x) | ||
@@ -83,4 +72,4 @@ } else | ||
// flip left | ||
right = target_position.left + offset.left - offset.right | ||
left = right - width + offset.right - offset.left | ||
right = target_position.left - offset.x | ||
left = right - width | ||
orientation.x = mirror(orientation.x) | ||
@@ -93,4 +82,4 @@ } | ||
// flip bottom | ||
top = target_position.bottom + offset.bottom - offset.top | ||
bottom = top + height + offset.top - offset.bottom | ||
top = target_position.bottom - offset.y | ||
bottom = top + height | ||
orientation.y = mirror(orientation.y) | ||
@@ -100,4 +89,4 @@ } else | ||
// flip top | ||
bottom = target_position.top + offset.top - offset.bottom | ||
top = bottom - height + offset.bottom - offset.top | ||
bottom = target_position.top - offset.y | ||
top = bottom - height | ||
orientation.y = mirror(orientation.y) | ||
@@ -112,4 +101,4 @@ } | ||
height: height, | ||
right: left + width, | ||
bottom: top + height, | ||
right: right, | ||
bottom: bottom, | ||
orientation: expr(orientation) | ||
@@ -116,0 +105,0 @@ } |
{ | ||
"name": "adjust-engine", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "adjust an element relative to another element", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -30,9 +30,7 @@ | ||
- **offset** (object): Specify an offset to apply to the attachment element. Here's some examples: | ||
- **offset** (object): Specify an offset to apply to the attachment element: | ||
``` | ||
bottom: -10 | ||
left: 100 | ||
right: 50 | ||
top: -25 | ||
x: 10 | ||
y: -10 | ||
``` | ||
@@ -39,0 +37,0 @@ |
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
8415
194
85