From ba8a7ecc48ddb0990f22d04f99937166c957ed5d Mon Sep 17 00:00:00 2001 From: Gar Date: Sat, 25 Feb 2017 22:22:57 -0500 Subject: [PATCH] feat(sdfsdf): sdfsdf --- index.html | 2 ++ package.json | 4 +++- src/App.js | 16 ++++++++++++++++ src/Handwrite.js | 6 ------ src/dev.js | 26 ++++++-------------------- src/index.css | 3 +++ webpack.config.utilities.babel.js | 20 -------------------- 7 files changed, 30 insertions(+), 47 deletions(-) create mode 100644 src/App.js create mode 100644 src/index.css delete mode 100644 webpack.config.utilities.babel.js diff --git a/index.html b/index.html index 58cfde7..f407ab4 100644 --- a/index.html +++ b/index.html @@ -62,6 +62,8 @@

Preview Masking effects using handwrite.js

+
+ diff --git a/package.json b/package.json index 5c320b3..fd2e2a8 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,9 @@ "testEnvironment": "jsdom" }, "dependencies": { - "signals": "1.0.0" + "signals": "1.0.0", + "react": "15.4.2", + "react-dom": "15.4.2" }, "author": "Gar Liu (http://lonelydatum.com/)", "license": "MIT", diff --git a/src/App.js b/src/App.js new file mode 100644 index 0000000..c413e7a --- /dev/null +++ b/src/App.js @@ -0,0 +1,16 @@ +import React, { Component } from 'react'; +import styles from './index.css' + + +export class App extends Component { + render() { + return ( +
+ +
+ ); + } +} + + +export default App; \ No newline at end of file diff --git a/src/Handwrite.js b/src/Handwrite.js index c4f05cf..f6e8e8f 100644 --- a/src/Handwrite.js +++ b/src/Handwrite.js @@ -57,18 +57,12 @@ class Handwrite { drawArt() { - this.ctxArt.clearRect(0, 0, this.WIDTH, this.HEIGHT) this.ctxArt.drawImage(this.canvasMask, 0, 0); - this.ctxArt.save(); - this.ctxArt.globalCompositeOperation = 'source-in'; - this.ctxArt.drawImage(this.image, 0, 0); - this.ctxArt.restore(); - } render() { diff --git a/src/dev.js b/src/dev.js index 6c1f8c6..65ee326 100644 --- a/src/dev.js +++ b/src/dev.js @@ -3,6 +3,7 @@ import Capture from './Capture.js' import Handwrite from './Handwrite.js' + const dragTarget = document.getElementById('dragTarget'); const captureCanvas = document.getElementById('captureCanvas'); const captureImage = document.getElementById('captureImage'); @@ -29,6 +30,7 @@ class Dev { this.brush = brushSize.value this.image = null + console.log(localStorage); if(localStorage.length>0) { this.updateFromLocal() this.ready() @@ -41,14 +43,17 @@ class Dev { brushSize.addEventListener('change', ()=>this.brushUpdate(brushSize.value)) drawButton.addEventListener('click', this.draw.bind(this), false ) undo.addEventListener('click', this.undo.bind(this)) - startOver.addEventListener('click', this.capture.startOver.bind(this.capture) ) + } ready() { + console.log(this.points); this.capture = new Capture(captureCanvas, brushSize.value, this.points) this.handwrite = new Handwrite(renderCanvas, renderImage) this.capture.signals.pointsUpdated.add(this.pointsUpdated) + startOver.addEventListener('click', this.capture.startOver.bind(this.capture) ) + this.loadImage(this.image) this.pointsUpdated(this.points); this.brushUpdate(this.brush) @@ -102,24 +107,5 @@ class Dev { } - - - - - - - - - - - - - - - - - - - export default new Dev() diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..6c9ed17 --- /dev/null +++ b/src/index.css @@ -0,0 +1,3 @@ +.main { + +} \ No newline at end of file diff --git a/webpack.config.utilities.babel.js b/webpack.config.utilities.babel.js deleted file mode 100644 index 3e9c930..0000000 --- a/webpack.config.utilities.babel.js +++ /dev/null @@ -1,20 +0,0 @@ -import {join} from 'path' - -const include = join(__dirname, 'src') - -export default { - entry: './src/util/Utility.js', - output: { - path: join(__dirname, 'dist'), - libraryTarget: 'umd', - library: 'FrecklesUtility', - }, - devtool: 'source-map', - module: { - loaders: [ - {test: /\.js$/, loader: 'babel-loader', include}, - {test: /\.json$/, 'loader': 'json-loader', include}, - ] - } -} -