@interactjs/snappers
Advanced tools
Comparing version 1.10.23 to 1.10.24
import type { Rect, Point } from '@interactjs/core/types'; | ||
import type { SnapFunction } from '@interactjs/modifiers/snap/pointer'; | ||
export declare type GridOptions = (Partial<Rect> | Point) & { | ||
export interface GridOptionsBase { | ||
range?: number; | ||
limits?: Rect; | ||
offset?: Point; | ||
}; | ||
} | ||
export interface GridOptionsXY extends GridOptionsBase { | ||
x: number; | ||
y: number; | ||
} | ||
export interface GridOptionsTopLeft extends GridOptionsBase { | ||
top?: number; | ||
left?: number; | ||
} | ||
export interface GridOptionsBottomRight extends GridOptionsBase { | ||
bottom?: number; | ||
right?: number; | ||
} | ||
export interface GridOptionsWidthHeight extends GridOptionsBase { | ||
width?: number; | ||
height?: number; | ||
} | ||
export type GridOptions = GridOptionsXY | GridOptionsTopLeft | GridOptionsBottomRight | GridOptionsWidthHeight; | ||
declare const _default: (grid: GridOptions) => SnapFunction & { | ||
@@ -9,0 +26,0 @@ grid: GridOptions; |
export default (grid => { | ||
const coordFields = [['x', 'y'], ['left', 'top'], ['right', 'bottom'], ['width', 'height']].filter(([xField, yField]) => xField in grid || yField in grid); | ||
const gridFunc = (x, y) => { | ||
@@ -24,3 +23,2 @@ const { | ||
}; | ||
for (const [xField, yField] of coordFields) { | ||
@@ -32,6 +30,4 @@ const gridx = Math.round((x - offset.x) / grid[xField]); | ||
} | ||
return result; | ||
}; | ||
gridFunc.grid = grid; | ||
@@ -38,0 +34,0 @@ gridFunc.coordFields = coordFields; |
{ | ||
"name": "@interactjs/snappers", | ||
"version": "1.10.23", | ||
"version": "1.10.24", | ||
"main": "index", | ||
@@ -13,6 +13,6 @@ "module": "index", | ||
"peerDependencies": { | ||
"@interactjs/utils": "1.10.23" | ||
"@interactjs/utils": "1.10.24" | ||
}, | ||
"optionalDependencies": { | ||
"@interactjs/interact": "1.10.23" | ||
"@interactjs/interact": "1.10.24" | ||
}, | ||
@@ -27,3 +27,3 @@ "publishConfig": { | ||
"license": "MIT", | ||
"gitHead": "9ba48631" | ||
"gitHead": "86c64a3f" | ||
} |
@@ -5,3 +5,2 @@ import extend from "../utils/extend.js"; | ||
id: 'snappers', | ||
install(scope) { | ||
@@ -14,5 +13,4 @@ const { | ||
} | ||
}; | ||
export default snappersPlugin; | ||
//# sourceMappingURL=plugin.js.map |
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
18361
116