Save paths
This commit is contained in:
parent
02f21f1ccd
commit
ee17944737
|
@ -0,0 +1,102 @@
|
||||||
|
dist/
|
||||||
|
|
||||||
|
node_modules/
|
||||||
|
.node_modules/
|
||||||
|
built/*
|
||||||
|
tests/cases/rwc/*
|
||||||
|
tests/cases/test262/*
|
||||||
|
tests/cases/perf/*
|
||||||
|
!tests/cases/webharness/compilerToString.js
|
||||||
|
test-args.txt
|
||||||
|
~*.docx
|
||||||
|
\#*\#
|
||||||
|
.\#*
|
||||||
|
tests/baselines/local/*
|
||||||
|
tests/baselines/local.old/*
|
||||||
|
tests/services/baselines/local/*
|
||||||
|
tests/baselines/prototyping/local/*
|
||||||
|
tests/baselines/rwc/*
|
||||||
|
tests/baselines/test262/*
|
||||||
|
tests/baselines/reference/projectOutput/*
|
||||||
|
tests/baselines/local/projectOutput/*
|
||||||
|
tests/baselines/reference/testresults.tap
|
||||||
|
tests/services/baselines/prototyping/local/*
|
||||||
|
tests/services/browser/typescriptServices.js
|
||||||
|
src/harness/*.js
|
||||||
|
src/compiler/diagnosticInformationMap.generated.ts
|
||||||
|
src/compiler/diagnosticMessages.generated.json
|
||||||
|
src/parser/diagnosticInformationMap.generated.ts
|
||||||
|
src/parser/diagnosticMessages.generated.json
|
||||||
|
rwc-report.html
|
||||||
|
*.swp
|
||||||
|
build.json
|
||||||
|
*.actual
|
||||||
|
tests/webTestServer.js
|
||||||
|
tests/webTestServer.js.map
|
||||||
|
tests/webhost/*.d.ts
|
||||||
|
tests/webhost/webtsc.js
|
||||||
|
tests/cases/**/*.js
|
||||||
|
!tests/cases/docker/*.js/
|
||||||
|
tests/cases/**/*.js.map
|
||||||
|
*.config
|
||||||
|
scripts/eslint/built/
|
||||||
|
scripts/debug.bat
|
||||||
|
scripts/run.bat
|
||||||
|
scripts/word2md.js
|
||||||
|
scripts/buildProtocol.js
|
||||||
|
scripts/ior.js
|
||||||
|
scripts/authors.js
|
||||||
|
scripts/configurePrerelease.js
|
||||||
|
scripts/configureLanguageServiceBuild.js
|
||||||
|
scripts/open-user-pr.js
|
||||||
|
scripts/open-cherry-pick-pr.js
|
||||||
|
scripts/processDiagnosticMessages.d.ts
|
||||||
|
scripts/processDiagnosticMessages.js
|
||||||
|
scripts/produceLKG.js
|
||||||
|
scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.js
|
||||||
|
scripts/generateLocalizedDiagnosticMessages.js
|
||||||
|
scripts/request-pr-review.js
|
||||||
|
scripts/*.js.map
|
||||||
|
scripts/typings/
|
||||||
|
coverage/
|
||||||
|
internal/
|
||||||
|
**/.DS_Store
|
||||||
|
.settings
|
||||||
|
**/.vs
|
||||||
|
**/.vscode/*
|
||||||
|
!**/.vscode/tasks.json
|
||||||
|
!**/.vscode/settings.template.json
|
||||||
|
!**/.vscode/launch.template.json
|
||||||
|
!**/.vscode/extensions.json
|
||||||
|
!tests/cases/projects/projectOption/**/node_modules
|
||||||
|
!tests/cases/projects/NodeModulesSearch/**/*
|
||||||
|
!tests/baselines/reference/project/nodeModules*/**/*
|
||||||
|
.idea
|
||||||
|
yarn.lock
|
||||||
|
yarn-error.log
|
||||||
|
.parallelperf.*
|
||||||
|
tests/cases/user/*/package-lock.json
|
||||||
|
tests/cases/user/*/node_modules/
|
||||||
|
tests/cases/user/*/**/*.js
|
||||||
|
tests/cases/user/*/**/*.js.map
|
||||||
|
tests/cases/user/*/**/*.d.ts
|
||||||
|
!tests/cases/user/zone.js/
|
||||||
|
!tests/cases/user/bignumber.js/
|
||||||
|
!tests/cases/user/discord.js/
|
||||||
|
tests/baselines/reference/dt
|
||||||
|
.failed-tests
|
||||||
|
TEST-results.xml
|
||||||
|
package-lock.json
|
||||||
|
tests/cases/user/npm/npm
|
||||||
|
tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
|
||||||
|
tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
|
||||||
|
tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
|
||||||
|
tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
|
||||||
|
tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
|
||||||
|
tests/cases/user/create-react-app/create-react-app
|
||||||
|
tests/cases/user/fp-ts/fp-ts
|
||||||
|
tests/cases/user/webpack/webpack
|
||||||
|
tests/cases/user/puppeteer/puppeteer
|
||||||
|
tests/cases/user/axios-src/axios-src
|
||||||
|
tests/cases/user/prettier/prettier
|
||||||
|
.eslintcache
|
|
@ -10,10 +10,7 @@
|
||||||
"name": "Launch Chrome against localhost",
|
"name": "Launch Chrome against localhost",
|
||||||
"url": "http://localhost:8080",
|
"url": "http://localhost:8080",
|
||||||
"webRoot": "${workspaceFolder}",
|
"webRoot": "${workspaceFolder}",
|
||||||
"preLaunchTask": "npm debug",
|
"preLaunchTask": "npm debug"
|
||||||
"pathMapping": {
|
|
||||||
"/": "${workspaceFolder}/ts"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,39 +0,0 @@
|
||||||
class CanvasController {
|
|
||||||
constructor() {
|
|
||||||
this.isMouseDown = false;
|
|
||||||
this.x = 0;
|
|
||||||
this.y = 0;
|
|
||||||
this.canvas = document.createElement("canvas");
|
|
||||||
this.canvasDiv = document.querySelector("#canvas");
|
|
||||||
this.canvasDiv.appendChild(this.canvas);
|
|
||||||
this.canvas.width = this.canvas.offsetWidth;
|
|
||||||
this.canvas.height = this.canvas.offsetHeight;
|
|
||||||
this.ctx = this.canvas.getContext("2d");
|
|
||||||
// Events
|
|
||||||
this.canvasDiv.addEventListener("mousedown", e => this.onMouseDown(e));
|
|
||||||
this.canvasDiv.addEventListener("mouseup", () => this.onMouseUp());
|
|
||||||
this.canvasDiv.addEventListener("mousemove", e => this.onMouseMove(e));
|
|
||||||
}
|
|
||||||
onMouseDown(event) {
|
|
||||||
this.isMouseDown = true;
|
|
||||||
this.x = event.clientX;
|
|
||||||
this.y = event.clientY;
|
|
||||||
}
|
|
||||||
onMouseUp() {
|
|
||||||
this.isMouseDown = false;
|
|
||||||
}
|
|
||||||
onMouseMove(event) {
|
|
||||||
if (!this.isMouseDown || !this.ctx) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.ctx.beginPath();
|
|
||||||
this.ctx.moveTo(this.x, this.y);
|
|
||||||
this.ctx.lineTo(event.clientX, event.clientY);
|
|
||||||
this.ctx.lineWidth = 1;
|
|
||||||
this.ctx.stroke();
|
|
||||||
this.x = event.clientX;
|
|
||||||
this.y = event.clientY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const app = new CanvasController();
|
|
||||||
export { app };
|
|
|
@ -23,4 +23,4 @@
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</html>
|
</html>
|
||||||
|
|
19
ts/app.ts
19
ts/app.ts
|
@ -7,6 +7,9 @@ class CanvasController {
|
||||||
private x: number = 0;
|
private x: number = 0;
|
||||||
private y: number = 0;
|
private y: number = 0;
|
||||||
|
|
||||||
|
private paths: Coordinates[][] = [];
|
||||||
|
private currentPath: Coordinates[] = [];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.canvas = document.createElement("canvas");
|
this.canvas = document.createElement("canvas");
|
||||||
this.canvasDiv = document.querySelector("#canvas") as HTMLDivElement;
|
this.canvasDiv = document.querySelector("#canvas") as HTMLDivElement;
|
||||||
|
@ -26,10 +29,13 @@ class CanvasController {
|
||||||
this.isMouseDown = true;
|
this.isMouseDown = true;
|
||||||
this.x = event.clientX;
|
this.x = event.clientX;
|
||||||
this.y = event.clientY;
|
this.y = event.clientY;
|
||||||
|
this.currentPath = [new Coordinates(this.x, this.y)];
|
||||||
}
|
}
|
||||||
|
|
||||||
onMouseUp() {
|
onMouseUp() {
|
||||||
this.isMouseDown = false;
|
this.isMouseDown = false;
|
||||||
|
this.ctx?.closePath();
|
||||||
|
this.paths.push(this.currentPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMouseMove(event: MouseEvent) {
|
onMouseMove(event: MouseEvent) {
|
||||||
|
@ -43,11 +49,24 @@ class CanvasController {
|
||||||
this.ctx.lineWidth = 1;
|
this.ctx.lineWidth = 1;
|
||||||
this.ctx.stroke();
|
this.ctx.stroke();
|
||||||
|
|
||||||
|
this.currentPath.push(new Coordinates(event.clientX, event.clientY));
|
||||||
|
|
||||||
this.x = event.clientX;
|
this.x = event.clientX;
|
||||||
this.y = event.clientY;
|
this.y = event.clientY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Coordinates {
|
||||||
|
public x: number;
|
||||||
|
public y: number;
|
||||||
|
|
||||||
|
constructor(x: number, y: number) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const app = new CanvasController();
|
const app = new CanvasController();
|
||||||
|
|
||||||
export { app };
|
export { app };
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2015",
|
"target": "ES2015",
|
||||||
"module": "ES2015",
|
"module": "ES2015",
|
||||||
"outDir": "dist"
|
"outDir": "dist",
|
||||||
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"extends": "@tsconfig/recommended/tsconfig.json",
|
"extends": "@tsconfig/recommended/tsconfig.json",
|
||||||
"include": ["ts/**/*"],
|
"include": ["ts/**/*"],
|
||||||
|
|
Loading…
Reference in New Issue