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