From bf0e66c77c3a39046e14ea4b47413330ead50ddf Mon Sep 17 00:00:00 2001 From: Beau Blyth Date: Sat, 28 Sep 2019 10:59:50 -0700 Subject: [PATCH] beginning of pin settings --- app/page.ts | 7 +++++ app/pin_handler.ts | 26 +++++++++++++++++ dist/index.html | 2 ++ package.json | 70 +++++++++++++++++++++++----------------------- 4 files changed, 70 insertions(+), 35 deletions(-) create mode 100644 app/pin_handler.ts diff --git a/app/page.ts b/app/page.ts index 40ae60f..b3ba844 100644 --- a/app/page.ts +++ b/app/page.ts @@ -6,6 +6,7 @@ import { FrameHandler } from './frame_handler'; import { IAnimationData } from './Interfaces/IAnimationData'; import { ICanvasData } from './Interfaces/ICanvasData'; import { IFrame } from './Interfaces/IFrame'; +import { PinHandler } from './pin_handler'; export class Page { private static handleDragOver(evt: DragEvent) { @@ -16,6 +17,7 @@ export class Page { } } + private pinHandler: PinHandler; private frameHandler: FrameHandler; private canvasHandler: CanvasHandler; private animationData: IAnimationData; @@ -55,6 +57,11 @@ export class Page { const imageElement = new Image(); + this.pinHandler = new PinHandler( + document.getElementById('addpin') as HTMLElement, + document.getElementById('pinSettings') as HTMLElement + ); + // setup canvas this.canvasHandler = new CanvasHandler( this.animationData, diff --git a/app/pin_handler.ts b/app/pin_handler.ts new file mode 100644 index 0000000..8ba1ba6 --- /dev/null +++ b/app/pin_handler.ts @@ -0,0 +1,26 @@ +export class PinHandler { + private addPinButton: HTMLElement; + private pinSettingsDiv: HTMLElement; + private pins: number = 1; + + constructor(addPinButton: HTMLElement, pinSettingsDiv: HTMLElement) { + this.addPinButton = addPinButton; + this.pinSettingsDiv = pinSettingsDiv; + this.UpdatePinSettingsDiv(); + + this.addPinButton.addEventListener('click', this.AddPinButtonPressed); + } + + private UpdatePinSettingsDiv() { + let html: string = ''; + for (let i = 0; i < this.pins; i++) { + html += ''; + } + this.pinSettingsDiv.innerHTML = html; + } + + private AddPinButtonPressed() { + this.pins += 1; + this.UpdatePinSettingsDiv(); + } +} diff --git a/dist/index.html b/dist/index.html index fb37398..e65f05f 100644 --- a/dist/index.html +++ b/dist/index.html @@ -21,6 +21,8 @@
+ +
Name:
Click image to set Origin
diff --git a/package.json b/package.json index 8be1295..01a6d23 100644 --- a/package.json +++ b/package.json @@ -1,37 +1,37 @@ { - "name": "animationtool", - "version": "1.0.0", - "description": "The animation tool by Scrambler", - "main": "main.ts", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "build": "webpack --config webpack/prod.config.js", - "start:dev": "webpack-dev-server --config webpack/dev.config.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/MoonsideGames/AnimationTool.git" - }, - "author": "", - "license": "UNLICENSED", - "bugs": { - "url": "https://github.com/MoonsideGames/AnimationTool/issues" - }, - "homepage": "https://github.com/MoonsideGames/AnimationTool#readme", - "devDependencies": { - "prettier": "^1.18.2", - "ts-loader": "^6.1.2", - "tslint": "^5.20.0", - "tslint-config-prettier": "^1.18.0", - "typescript": "^3.6.3", - "webpack": "^4.41.0", - "webpack-cli": "^3.3.9", - "webpack-dev-server": "^3.8.1" - }, - "dependencies": { - "@types/file-saver": "^2.0.1", - "@types/jszip": "^3.1.6", - "file-saver": "^2.0.2", - "jszip": "^3.2.2" - } + "name": "animationtool", + "version": "1.0.0", + "description": "The animation tool by Scrambler", + "main": "main.ts", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "webpack --config webpack/prod.config.js", + "start:dev": "webpack-dev-server --config webpack/dev.config.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/MoonsideGames/AnimationTool.git" + }, + "author": "", + "license": "UNLICENSED", + "bugs": { + "url": "https://github.com/MoonsideGames/AnimationTool/issues" + }, + "homepage": "https://github.com/MoonsideGames/AnimationTool#readme", + "devDependencies": { + "prettier": "^1.18.2", + "ts-loader": "^6.1.2", + "tslint": "^5.20.0", + "tslint-config-prettier": "^1.18.0", + "typescript": "^3.6.3", + "webpack": "^4.41.0", + "webpack-cli": "^3.3.9", + "webpack-dev-server": "^3.8.1" + }, + "dependencies": { + "@types/file-saver": "^2.0.1", + "@types/jszip": "^3.1.6", + "file-saver": "^2.0.2", + "jszip": "^3.2.2" + } }