Commit 42c972ba61a59e2b071534f81089a178c1069cc4
1 parent
abf2f854
fix(shape): add style for shape
Showing
2 changed files
with
5 additions
and
4 deletions
front-end/h5/src/components/core/editor/canvas/edit.js
| @@ -132,9 +132,11 @@ export default { | @@ -132,9 +132,11 @@ export default { | ||
| 132 | > | 132 | > |
| 133 | { | 133 | { |
| 134 | elements.map((element, index) => { | 134 | elements.map((element, index) => { |
| 135 | - const style = element.getStyle() | ||
| 136 | const data = { | 135 | const data = { |
| 137 | - style, | 136 | + style: { |
| 137 | + width: '100%', | ||
| 138 | + height: '100%' | ||
| 139 | + }, | ||
| 138 | // 添加 class 的原因:与 handleClickCanvasProp 配合, | 140 | // 添加 class 的原因:与 handleClickCanvasProp 配合, |
| 139 | // 当点击编辑画布上的其它区域(clickEvent.target.classList 不包含下面的 className)的时候,设置 editingElement=null | 141 | // 当点击编辑画布上的其它区域(clickEvent.target.classList 不包含下面的 className)的时候,设置 editingElement=null |
| 140 | class: 'element-on-edit-canvas', | 142 | class: 'element-on-edit-canvas', |
| @@ -151,6 +153,7 @@ export default { | @@ -151,6 +153,7 @@ export default { | ||
| 151 | } | 153 | } |
| 152 | return ( | 154 | return ( |
| 153 | <Shape | 155 | <Shape |
| 156 | + style={element.getStyle('absolute')} | ||
| 154 | defaultPosition={element.commonStyle} | 157 | defaultPosition={element.commonStyle} |
| 155 | element={element} | 158 | element={element} |
| 156 | active={this.editingElement === element} | 159 | active={this.editingElement === element} |
front-end/h5/src/components/core/support/shape.js
| @@ -139,12 +139,10 @@ export default { | @@ -139,12 +139,10 @@ export default { | ||
| 139 | } | 139 | } |
| 140 | }, | 140 | }, |
| 141 | render (h) { | 141 | render (h) { |
| 142 | - const style = this.element.getStyle('absolute'/** position */) | ||
| 143 | return ( | 142 | return ( |
| 144 | <div | 143 | <div |
| 145 | onClick={this.handleWrapperClick} | 144 | onClick={this.handleWrapperClick} |
| 146 | onMousedown={this.handleMousedown} | 145 | onMousedown={this.handleMousedown} |
| 147 | - style={style} | ||
| 148 | > | 146 | > |
| 149 | { | 147 | { |
| 150 | this.active && | 148 | this.active && |