diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 9e33014..0000000 --- a/TODO.md +++ /dev/null @@ -1,8 +0,0 @@ -1. 新建字体文件之后,存在大于0xFFFF的unicode,生成的ttf无法识别小于0xFFFF的字体 - -2. svg g,defs 组支持 - -3. 路径的交、并、差集在特殊情况下会buzz - - -4. 图片导入只能导入轮廓鲜明的图像,图像拟合效果不好 diff --git a/config/webpack.demo.js b/config/webpack.demo.js new file mode 100644 index 0000000..2dbe44a --- /dev/null +++ b/config/webpack.demo.js @@ -0,0 +1,131 @@ +/** + * @file webpack 配置 + * @author mengke01(kekee000@gmail.com) + */ + +const fs = require('fs'); +const path = require('path'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const DEMO_DIR = path.resolve(__dirname, '../demo'); + +function getEntries() { + let files = fs.readdirSync(DEMO_DIR + '/js'); + let entries = {}; + for (let file of files) { + if (file.endsWith('.js')) { + let entryScript = file.replace('.js', ''); + entries[entryScript] = './demo/js/' + file; + } + } + return entries; +} + + +function getHtmlPages() { + let files = fs.readdirSync(DEMO_DIR); + let pages = []; + for (let file of files) { + if (file.endsWith('.html')) { + let entryScript = file.replace('.html', ''); + pages.push( + new HtmlWebpackPlugin({ + title: file, + filename: 'demo/' + file, + template: path.resolve(DEMO_DIR, file), + chunks: [entryScript] + }) + ); + } + } + return pages; +} + +module.exports = { + entry: getEntries(), + output: { + path: path.resolve(__dirname, '../dist'), + filename: 'js/[name].js' + }, + devtool: 'inline-source-map', + devServer: { + contentBase: './' + }, + resolve: { + extensions: ['.js', '.jsx', '.json'], + alias: { + 'css': path.resolve(__dirname, '../css'), + 'common': path.resolve(__dirname, '../src/common'), + 'graphics': path.resolve(__dirname, '../src/graphics'), + 'math': path.resolve(__dirname, '../src/math'), + 'editor': path.resolve(__dirname, '../src/editor'), + 'render': path.resolve(__dirname, '../src/render'), + 'fonteditor-core': path.resolve(__dirname, '../node_modules/fonteditor-core/src'), + 'JSZip$': path.resolve(__dirname, '../dep/jszip/jszip.min.js'), + 'inflate$': path.resolve(__dirname, '../dep/pako_inflate.min.js'), + 'deflate$': path.resolve(__dirname, '../dep/pako_deflate.min.js'), + 'paper$': path.resolve(__dirname, '../dep/paper-full.js'), + 'utpl$': path.resolve(__dirname, '../dep/utpl.min.js') + } + }, + externals: { + jquery: 'window.jQuery', + $: 'window.jQuery' + }, + plugins: [ + new HtmlWebpackPlugin({ + title: 'index page', + filename: 'index.html', + template: path.resolve(DEMO_DIR, 'index.html'), + chunks: ['index'] + }), + ...getHtmlPages() + ], + module: { + rules: [ + { + test: /\/(index|empty|editor)\.tpl$/, + loader: 'index-loader' + }, + { + test: /template\/(.+?)\.tpl$/, + loader: 'tpl-loader' + }, + { + test: /\.lesstpl$/, + use: [ + 'css-loader', + 'less-loader' + ] + }, + { + test: /\.less$/, + use: ['style-loader', 'css-loader', 'less-loader'] + }, + { + test: /\.(png|svg|jpg|gif)$/, + use: [ + { + loader: 'url-loader', + options: { + limit: 1000 + } + } + ] + }, + { + test: /\.(woff|woff2|eot|ttf|otf|wasm)$/, + use: [ + { + loader: 'url-loader', + options: { + limit: 1000 + } + } + ] + } + ] + }, + resolveLoader: { + modules: [path.resolve(__dirname, '../build'), 'node_modules'] + } +}; diff --git a/demo/bezierSegmentCross.html b/demo/bezierSegmentCross.html index 8266665..98645d2 100644 --- a/demo/bezierSegmentCross.html +++ b/demo/bezierSegmentCross.html @@ -40,22 +40,5 @@
- - - diff --git a/demo/bezierSplit.html b/demo/bezierSplit.html index 824d12e..dc6d4bb 100644 --- a/demo/bezierSplit.html +++ b/demo/bezierSplit.html @@ -3,7 +3,6 @@ 贝塞尔分割 - -
- - - diff --git a/demo/data/contours-5.js b/demo/data/contours-5.js index 7ff3557..3d2cd95 100644 --- a/demo/data/contours-5.js +++ b/demo/data/contours-5.js @@ -1,6 +1,2 @@ -define( - function(require) { - return {"xMin":66,"yMin":22,"xMax":500,"yMax":430,"unicode":[57357],"advanceWidth":633,"leftSideBearing":66,"name":"uniE00D","contours":[[{"x":226,"y":255},{"x":272,"y":301},{"x":272,"y":367},{"x":226,"y":413},{"x":160,"y":413},{"x":114,"y":367},{"x":114,"y":301},{"x":160,"y":255}],[{"x":431,"y":242},{"x":486,"y":297},{"x":486,"y":375},{"x":431,"y":430},{"x":353,"y":430},{"x":298,"y":375},{"x":298,"y":297},{"x":353,"y":242}],[{"x":196,"y":22},{"x":250,"y":76},{"x":250,"y":152},{"x":196,"y":206},{"x":119,"y":206},{"x":66,"y":152},{"x":66,"y":76},{"x":119,"y":22}],[{"x":178,"y":340,"onCurve":true},{"x":423,"y":340,"onCurve":true},{"x":423,"y":113,"onCurve":true},{"x":178,"y":113,"onCurve":true}],[{"x":446,"y":28},{"x":500,"y":82},{"x":500,"y":158},{"x":446,"y":212},{"x":369,"y":212},{"x":316,"y":158},{"x":316,"y":82},{"x":369,"y":28}]]} - } -); +module.exports = {"xMin":66,"yMin":22,"xMax":500,"yMax":430,"unicode":[57357],"advanceWidth":633,"leftSideBearing":66,"name":"uniE00D","contours":[[{"x":226,"y":255},{"x":272,"y":301},{"x":272,"y":367},{"x":226,"y":413},{"x":160,"y":413},{"x":114,"y":367},{"x":114,"y":301},{"x":160,"y":255}],[{"x":431,"y":242},{"x":486,"y":297},{"x":486,"y":375},{"x":431,"y":430},{"x":353,"y":430},{"x":298,"y":375},{"x":298,"y":297},{"x":353,"y":242}],[{"x":196,"y":22},{"x":250,"y":76},{"x":250,"y":152},{"x":196,"y":206},{"x":119,"y":206},{"x":66,"y":152},{"x":66,"y":76},{"x":119,"y":22}],[{"x":178,"y":340,"onCurve":true},{"x":423,"y":340,"onCurve":true},{"x":423,"y":113,"onCurve":true},{"x":178,"y":113,"onCurve":true}],[{"x":446,"y":28},{"x":500,"y":82},{"x":500,"y":158},{"x":446,"y":212},{"x":369,"y":212},{"x":316,"y":158},{"x":316,"y":82},{"x":369,"y":28}]]} \ No newline at end of file diff --git a/demo/datastore.html b/demo/datastore.html index 5859cc4..4100286 100644 --- a/demo/datastore.html +++ b/demo/datastore.html @@ -3,29 +3,9 @@ 测试editor - - - - diff --git a/demo/editor-iframe.html b/demo/editor-iframe.html index 3340837..631b00e 100644 --- a/demo/editor-iframe.html +++ b/demo/editor-iframe.html @@ -3,7 +3,6 @@ 测试editor远程调用 -