From 0957d53b41cda93a356a3f9d6d7babeff62da5b0 Mon Sep 17 00:00:00 2001 From: Casper Lamboo Date: Mon, 23 Apr 2018 10:55:11 +0200 Subject: [PATCH] fix font loading @companje --- package-lock.json | 22 +++++++++++++++++++--- package.json | 3 ++- src/interface/index.js | 4 ++-- webpack.config.js | 13 +++++++++++++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index bb8510b..b2fcd31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ } }, "@doodle3d/doodle3d-core": { - "version": "github:doodle3d/doodle3d-core#b9ed59c8d936a205ac3660fe6f23af66228d92bb", + "version": "github:doodle3d/doodle3d-core#0a3686d8df05e275805ebb8029528a45d7f31f39", "requires": { "@doodle3d/cal": "0.0.8", "@doodle3d/clipper-js": "1.0.10", @@ -47,6 +47,7 @@ "blueimp-canvas-to-blob": "3.14.0", "bowser": "1.8.1", "fit-curve": "0.1.6", + "font-loaded": "1.0.0", "google-fonts-webpack-plugin": "0.4.4", "imports-loader": "0.7.1", "jss": "9.8.1", @@ -3693,8 +3694,7 @@ "events": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", - "dev": true + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=" }, "eventsource": { "version": "0.1.6", @@ -4199,6 +4199,17 @@ } } }, + "font-loaded": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/font-loaded/-/font-loaded-1.0.0.tgz", + "integrity": "sha512-/qicwhzOAnob/EOguqhk12ccQL50BIkU+j+5mjauQCWKLek4WVag6TmsDGL9bZtgJRlOeLXb5Ul1wSgO/003EA==", + "requires": { + "events": "1.1.1", + "inherits": "2.0.3", + "lodash": "4.17.4", + "timeout-raf": "1.1.4" + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -11073,6 +11084,11 @@ "integrity": "sha1-lYYL/MXHbCd/j4Mm/Q9bLiDrohc=", "dev": true }, + "timeout-raf": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/timeout-raf/-/timeout-raf-1.1.4.tgz", + "integrity": "sha512-RRVaW01Dj9tiTiq2eyg5FW22qc+ZzCHKUpr8Q5OB6+eVv9bCrmpk8oc5Cx/qiKqecQ7sjNJ85HDqMjdZLroqmg==" + }, "timers-browserify": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.4.tgz", diff --git a/package.json b/package.json index c02eea4..e045faf 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "dependencies": { "@doodle3d/clipper-js": "^1.0.10", "@doodle3d/doodle3d-api": "^1.0.5", - "@doodle3d/doodle3d-core": "github:doodle3d/doodle3d-core#0.18.0", + "@doodle3d/doodle3d-core": "github:doodle3d/doodle3d-core", "babel-plugin-transform-class-properties": "^6.24.1", "file-saver": "^1.3.3", "lodash": "^4.17.4", @@ -57,6 +57,7 @@ "eslint-config-airbnb": "^3.1.0", "eslint-plugin-react": "^3.16.1", "file-loader": "^1.1.11", + "google-fonts-webpack-plugin": "^0.4.4", "html-webpack-plugin": "^2.29.0", "html-webpack-template": "^6.0.2", "image-webpack-loader": "^4.2.0", diff --git a/src/interface/index.js b/src/interface/index.js index 0e3f1e5..294ea3a 100644 --- a/src/interface/index.js +++ b/src/interface/index.js @@ -160,8 +160,8 @@ class Interface extends React.Component { fetch(`${origin}${port}${pathname}`, { headers }) .then(resonse => resonse.json()) - .then(json => JSONToSketchData(json)) - .then(file => createSceneData(file)) + .then(JSONToSketchData) + .then(createSceneData) .then(sketch => generateExportMesh(sketch, { offsetSingleWalls: false, matrix: new THREE.Matrix4() })) .then(mesh => this.updateMesh(mesh)); }; diff --git a/webpack.config.js b/webpack.config.js index f54e505..8912591 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,7 @@ const path = require('path'); const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const HTMLWebpackPlugin = require('html-webpack-plugin'); +const GoogleFontsPlugin = require('google-fonts-webpack-plugin'); const devMode = process.env.NODE_ENV !== 'production'; const analyzeBundle = process.env.ANALYZE_BUNDLE; @@ -87,6 +88,18 @@ module.exports = { template: require('html-webpack-template'), inject: false, appMountId: 'app' + }), + new GoogleFontsPlugin({ + fonts: [ + { family: 'Oswald' }, + { family: 'Ranga' }, + { family: 'Joti One' }, + { family: 'Bellefair' }, + { family: 'Lobster' }, + { family: 'Abril Fatface' }, + { family: 'Play' }, + { family: 'Fascinate' } + ] }) ], devtool: devMode ? 'source-map' : false,