@interactjs/utils
Advanced tools
Comparing version 1.8.0-alpha.0 to 1.8.0-alpha.1
@@ -7,3 +7,2 @@ const domObjects = { | ||
SVGSVGElement: null, | ||
// eslint-disable-next-line no-undef | ||
SVGElementInstance: null, | ||
@@ -10,0 +9,0 @@ Element: null, |
import { rectToXY, resolveRectLike } from "./rect.js"; | ||
export default function (target, element, action) { | ||
const actionOptions = target.options[action]; | ||
export default function (target, element, actionName) { | ||
const actionOptions = target.options[actionName]; | ||
const actionOrigin = actionOptions && actionOptions.origin; | ||
@@ -5,0 +5,0 @@ const origin = actionOrigin || target.options.origin; |
{ | ||
"name": "@interactjs/utils", | ||
"version": "1.8.0-alpha.0", | ||
"version": "1.8.0-alpha.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
16
rect.js
@@ -16,13 +16,15 @@ import { closest, getElementRect, parentNode } from "./domUtils.js"; | ||
export function resolveRectLike(value, target, element, functionArgs) { | ||
if (is.string(value)) { | ||
value = getStringOptionResult(value, target, element); | ||
} else if (is.func(value)) { | ||
value = value(...functionArgs); | ||
let returnValue = value; | ||
if (is.string(returnValue)) { | ||
returnValue = getStringOptionResult(returnValue, target, element); | ||
} else if (is.func(returnValue)) { | ||
returnValue = returnValue(...functionArgs); | ||
} | ||
if (is.element(value)) { | ||
value = getElementRect(value); | ||
if (is.element(returnValue)) { | ||
returnValue = getElementRect(returnValue); | ||
} | ||
return value; | ||
return returnValue; | ||
} | ||
@@ -29,0 +31,0 @@ export function rectToXY(rect) { |
function createGrid(grid) { | ||
const coordFields = [['x', 'y'], ['left', 'top'], ['right', 'bottom'], ['width', 'height']].filter(([xField, yField]) => xField in grid || yField in grid); | ||
const gridFunc = function snapGrid(x, y) { | ||
const gridFunc = (x, y) => { | ||
const { | ||
@@ -19,3 +19,6 @@ range, | ||
const result = { | ||
range | ||
range, | ||
grid, | ||
x: null, | ||
y: null | ||
}; | ||
@@ -33,3 +36,2 @@ | ||
gridFunc._isSnapGrid = true; | ||
gridFunc.grid = grid; | ||
@@ -36,0 +38,0 @@ gridFunc.coordFields = coordFields; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
124312
43
1035