Skip to content

Commit

Permalink
添加demo1
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijun committed Sep 23, 2019
1 parent 45f47c4 commit b3a6a87
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 13 deletions.
37 changes: 28 additions & 9 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ class App extends React.Component {
maxLines = maxLines / 1;
padding = 0 /* padding / 1 */;
lineHeight = lineHeight / 1; //和painter调试得出的值
shadow = shadow.trim().split(/\s+/).join(' ');
shadow = shadow
.trim()
.split(/\s+/)
.join(' ');
let Shape;
let config = {
width, //文字的高度随行高
Expand Down Expand Up @@ -447,7 +450,10 @@ class App extends React.Component {
borderRadius = borderRadius / 1;
borderWidth = borderWidth / 1;
rotate = rotate / 1;
shadow = shadow.trim().split(/\s+/).join(' ');
shadow = shadow
.trim()
.split(/\s+/)
.join(' ');
let group = new fabric.Group([], {
left: left + width / 2 + borderWidth,
top: top + height / 2 + borderWidth,
Expand Down Expand Up @@ -539,7 +545,10 @@ class App extends React.Component {
borderRadius = borderRadius / 1;
borderWidth = borderWidth / 1;
rotate = rotate / 1;
shadow = shadow.trim().split(/\s+/).join(' ');
shadow = shadow
.trim()
.split(/\s+/)
.join(' ');
let Shape = await this.loadImageUrl(url);
let imgWidth = Shape.width;
let imgHeight = Shape.height;
Expand Down Expand Up @@ -1276,18 +1285,28 @@ ${json.plain(this.finallObj).replace(/px/g, 'px')}
</div>
<div className='example'>
{exampleData.map((item, i) => {
console.log('item', item);
//console.log('item', item);
return (
<div
className='li'
key={i}
onClick={() => {
this.setState(
{
importCodeJson: item.json
let that = this;
Modal.confirm({
title: '提示',
content: '确定要导入这个模板吗?',
okText: '确认',
cancelText: '取消',
onOk() {
that.setState(
{
importCodeJson: item.json
},
that.confirmImportCode
);
},
this.confirmImportCode
);
onCancel() {}
});
}}
>
<img src={item.src} alt='' />
Expand Down
16 changes: 14 additions & 2 deletions src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,21 @@ input {
}
}
.example {
width: 400px;
width: 440px;
min-height: 300px;
background: #eeeeee;
background: #e9fffe;
display: flex;
justify-content: space-between;
.li {
width: 200px;
height: 306px;
margin-top: 10px;
cursor: pointer;
img {
width: 100%;
height: 100%;
}
}
}
}
.option {
Expand Down
Binary file added src/example/example1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/example/example1.js

Large diffs are not rendered by default.

Binary file not shown.

0 comments on commit b3a6a87

Please sign in to comment.