Skip to content

Commit e7999fe

Browse files
committed
fixed bug
1 parent 1b1c70e commit e7999fe

File tree

7 files changed

+39
-37
lines changed

7 files changed

+39
-37
lines changed

build/webpack.prod.conf.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
'use strict'
2-
const path = require('path')
3-
const utils = require('./utils')
4-
const webpack = require('webpack')
5-
const config = require('../config')
6-
const merge = require('webpack-merge')
7-
const baseWebpackConfig = require('./webpack.base.conf')
8-
const CopyWebpackPlugin = require('copy-webpack-plugin')
9-
const HtmlWebpackPlugin = require('html-webpack-plugin')
10-
const ExtractTextPlugin = require('extract-text-webpack-plugin')
11-
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
12-
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
1+
'use strict';
2+
const path = require('path');
3+
const utils = require('./utils');
4+
const webpack = require('webpack');
5+
const config = require('../config');
6+
const merge = require('webpack-merge');
7+
const baseWebpackConfig = require('./webpack.base.conf');
8+
const CopyWebpackPlugin = require('copy-webpack-plugin');
9+
const HtmlWebpackPlugin = require('html-webpack-plugin');
10+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
11+
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
12+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
1313

14-
const env = require('../config/prod.env')
14+
const env = require('../config/prod.env');
1515

1616
const webpackConfig = merge(baseWebpackConfig, {
1717
module: {
@@ -26,6 +26,7 @@ const webpackConfig = merge(baseWebpackConfig, {
2626
path: config.build.assetsRoot,
2727
publicPath: config.build.assetsPublicPath,
2828
filename: 'vue-fabric.min.js',
29+
chunkFilename: 'vue-fabric.[name].[chunkhash:8].js',
2930
library: 'vue-fabric',
3031
libraryTarget: 'umd'
3132
},
@@ -43,33 +44,32 @@ const webpackConfig = merge(baseWebpackConfig, {
4344
// extract css into its own file
4445
new ExtractTextPlugin({
4546
// filename: utils.assetsPath('css/[name].[contenthash].css')
46-
filename: 'vue-fabric.min.css'
47+
filename: 'vue-fabric.min.css'
4748
}),
4849
new OptimizeCSSPlugin()
4950
]
50-
})
51+
});
5152

5253
if (config.build.productionGzip) {
53-
const CompressionWebpackPlugin = require('compression-webpack-plugin')
54+
const CompressionWebpackPlugin = require('compression-webpack-plugin');
5455

5556
webpackConfig.plugins.push(
5657
new CompressionWebpackPlugin({
5758
asset: '[path].gz[query]',
5859
algorithm: 'gzip',
5960
test: new RegExp(
60-
'\\.(' +
61-
config.build.productionGzipExtensions.join('|') +
62-
')$'
61+
'\\.(' + config.build.productionGzipExtensions.join('|') + ')$'
6362
),
6463
threshold: 10240,
6564
minRatio: 0.8
6665
})
67-
)
66+
);
6867
}
6968

7069
if (config.build.bundleAnalyzerReport) {
71-
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
72-
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
70+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
71+
.BundleAnalyzerPlugin;
72+
webpackConfig.plugins.push(new BundleAnalyzerPlugin());
7373
}
7474

75-
module.exports = webpackConfig
75+
module.exports = webpackConfig;

config/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
assetsSubDirectory: 'static',
1010
assetsPublicPath: '/',
1111
proxyTable: {},
12-
host: '0.0.0.0',
12+
host: '127.0.0.1',
1313
port: 8088,
1414
autoOpenBrowser: false,
1515
errorOverlay: true,

dist/vue-fabric.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-fabric",
3-
"version": "0.1.21",
3+
"version": "0.1.25",
44
"author": "purestart <[email protected]>",
55
"description": "fabric vue components",
66
"keywords": [

src/components/fabric/fabric.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,15 @@ export default {
247247
},
248248
discardActive () {
249249
this.canvas.discardActiveObject();
250-
this.canvas.discardActiveGroup();
250+
// this.canvas.discardActiveGroup();
251251
this.canvas.renderAll();
252252
},
253253
moveTo () {
254254
let obj = this.canvas.getActiveObject();
255255
console.log(this.canvas.sendBackwards);
256256
this.canvas.sendBackwards(obj, true);
257257
this.canvas.discardActiveObject();
258-
this.canvas.discardActiveGroup();
258+
// this.canvas.discardActiveGroup();
259259
},
260260
createRect (options) {
261261
options = Object.assign({ width: 0, height: 0, fillColor: 'rgba(255, 255, 255, 0)', left: 50, top: 50 }, options);
@@ -330,13 +330,14 @@ export default {
330330
this.canvas.renderAll();
331331
},
332332
createTextbox (text, options) {
333-
options = Object.assign({ fontSize: 14, fillColor: '#000000', registeObjectEvent: false, width: 50, _fontSizeMult: 5, left: 100, top: 100 }, options);
333+
// _fontSizeMult: 5,
334+
options = Object.assign({ fontSize: 14, fillColor: '#000000', registeObjectEvent: false, width: 50, left: 100, top: 100 }, options);
334335
var canvasObj = new fabric.Textbox(text, {
335336
...options,
336337
fill: options.fillColor
337338
});
338-
let arr = canvasObj._splitTextIntoLines(text);
339-
console.log(arr);
339+
// let arr = canvasObj._splitTextIntoLines(text);
340+
// console.log(arr);
340341
this.canvas.add(canvasObj);
341342
if (options.registeObjectEvent) {
342343
Utils.registeObjectEvent(this, canvasObj);

src/components/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1+
import Fabric from './fabric';
2+
// const App = () => import(/* webpackChunkName: "frame" */ './image-model.vue');
13

2-
3-
import Fabric from "./fabric";
4-
5-
export {
6-
Fabric
7-
};
4+
export { Fabric };

src/examples/index-pc.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<i @click="handleDelete" class="pt-iconfont icon-delete"></i>
1919
<i @click="rotate" class="pt-iconfont icon-shuaxin"></i>
2020
<i @click="createImg" class="pt-iconfont icon-crop"></i>
21+
<i @click="discardActive" class="pt-iconfont icon-crop"></i>
2122
</div>
2223
</div>
2324
<vue-image-model :close="()=>{imgUrl=''}" v-show="imgUrl.length>0" :url="imgUrl"></vue-image-model>
@@ -82,6 +83,9 @@ export default {
8283
this.$refs.canvas.drawByPath([[50, 50], [120, 120], [80, 160]], {});
8384
},
8485
methods: {
86+
discardActive () {
87+
this.$refs.canvas.discardActive();
88+
},
8589
handleAdd (url) {
8690
this.$refs.canvas.createImage(url);
8791
},

0 commit comments

Comments
 (0)