Skip to content

Commit

Permalink
Improve dragging behaviour when a scale transform is applied. (#24)
Browse files Browse the repository at this point in the history
* Code formatting.

* Improved the dragging behaviour when a scale transform is applied and improved the snapping behaviour to respect the scale as well.
  • Loading branch information
matrushka authored Nov 25, 2021
1 parent 7e68406 commit 8f7933a
Show file tree
Hide file tree
Showing 16 changed files with 1,069 additions and 1,039 deletions.
28 changes: 14 additions & 14 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const config = {
transform: {
'^.+\\.js$': 'babel-jest',
'^.+\\.svelte$': [
'svelte-jester',
{
preprocess: true,
},
],
'^.+\\.ts$': 'ts-jest',
},
moduleFileExtensions: ['js', 'ts', 'svelte'],
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
testEnvironment: 'jsdom',
transformIgnorePatterns: ['/node_modules/(?!(.+\\.svelte$))', '\\.pnp\\.[^\\/]+$'],
transform: {
'^.+\\.js$': 'babel-jest',
'^.+\\.svelte$': [
'svelte-jester',
{
preprocess: true,
},
],
'^.+\\.ts$': 'ts-jest',
},
moduleFileExtensions: ['js', 'ts', 'svelte'],
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
testEnvironment: 'jsdom',
transformIgnorePatterns: ['/node_modules/(?!(.+\\.svelte$))', '\\.pnp\\.[^\\/]+$'],
};

export default config;
122 changes: 61 additions & 61 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
{
"name": "svelte-drag",
"version": "2.2.1",
"description": "Svelte port of react-draggable",
"main": "dist/index.cjs",
"module": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",
"typings": "dist/index.d.ts",
"files": [
"dist/"
],
"sideEffects": false,
"exports": {
"import": "./dist/index.js",
"default": "./dist/index.js",
"require": "./dist/index.cjs"
},
"scripts": {
"test": "jest test",
"test:watch": "pnpm run test -- --watch",
"watch": "tsup --watch",
"prepublishOnly": "tsup",
"pub": "pnpm publish",
"format": "prettier --write --plugin-search-dir=. '**/*.{js,ts,tsx,json,svelte,html}'"
},
"repository": {
"type": "git",
"url": "git+https://github.com/PuruVJ/svelte-drag.git"
},
"keywords": [
"draggable",
"svelte",
"react-draggable",
"drag",
"svelte",
"small",
"tiny",
"performant"
],
"author": "Puru Vijay",
"license": "MIT",
"bugs": {
"url": "https://github.com/PuruVJ/svelte-drag/issues"
},
"homepage": "https://github.com/PuruVJ/svelte-drag#readme",
"devDependencies": {
"@babel/preset-env": "^7.16.4",
"@testing-library/jest-dom": "^5.15.1",
"@testing-library/svelte": "^3.0.3",
"babel-jest": "^27.3.1",
"jest": "^27.3.1",
"prettier": "^2.4.1",
"prettier-plugin-svelte": "^2.5.0",
"svelte": "^3.44.2",
"svelte-jester": "^2.1.5",
"svelte-preprocess": "^4.9.8",
"ts-jest": "^27.0.7",
"tsm": "^2.1.4",
"tsup": "^5.9.1",
"typescript": "^4.5.2"
}
"name": "svelte-drag",
"version": "2.2.1",
"description": "Svelte port of react-draggable",
"main": "dist/index.cjs",
"module": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",
"typings": "dist/index.d.ts",
"files": [
"dist/"
],
"sideEffects": false,
"exports": {
"import": "./dist/index.js",
"default": "./dist/index.js",
"require": "./dist/index.cjs"
},
"scripts": {
"test": "jest test",
"test:watch": "pnpm run test -- --watch",
"watch": "tsup --watch",
"prepublishOnly": "tsup",
"pub": "pnpm publish",
"format": "prettier --write --plugin-search-dir=. '**/*.{js,ts,tsx,json,svelte,html}'"
},
"repository": {
"type": "git",
"url": "git+https://github.com/PuruVJ/svelte-drag.git"
},
"keywords": [
"draggable",
"svelte",
"react-draggable",
"drag",
"svelte",
"small",
"tiny",
"performant"
],
"author": "Puru Vijay",
"license": "MIT",
"bugs": {
"url": "https://github.com/PuruVJ/svelte-drag/issues"
},
"homepage": "https://github.com/PuruVJ/svelte-drag#readme",
"devDependencies": {
"@babel/preset-env": "^7.16.4",
"@testing-library/jest-dom": "^5.15.1",
"@testing-library/svelte": "^3.0.3",
"babel-jest": "^27.3.1",
"jest": "^27.3.1",
"prettier": "^2.4.1",
"prettier-plugin-svelte": "^2.5.0",
"svelte": "^3.44.2",
"svelte-jester": "^2.1.5",
"svelte-preprocess": "^4.9.8",
"ts-jest": "^27.0.7",
"tsm": "^2.1.4",
"tsup": "^5.9.1",
"typescript": "^4.5.2"
}
}
10 changes: 5 additions & 5 deletions src/draggable.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export declare namespace svelte.JSX {
interface HTMLAttributes {
'onsvelte-drag:start'?: (e: CustomEvent<null>) => void;
'onsvelte-drag:end'?: (e: CustomEvent<null>) => void;
'onsvelte-drag'?: (e: CustomEvent<{ offsetX: number; offsetY: number }>) => void;
}
interface HTMLAttributes {
'onsvelte-drag:start'?: (e: CustomEvent<null>) => void;
'onsvelte-drag:end'?: (e: CustomEvent<null>) => void;
'onsvelte-drag'?: (e: CustomEvent<{ offsetX: number; offsetY: number }>) => void;
}
}
Loading

0 comments on commit 8f7933a

Please sign in to comment.