Skip to content

Commit bc88961

Browse files
authored
Merge pull request #117 from LibreSign/fix/get-width-and-height-of-text-item
fix: get width and height of text item
2 parents 28fed94 + 09a760f commit bc88961

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Components/TextItem.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ export default {
164164
// editable: null,
165165
dx: 0,
166166
dy: 0,
167+
width: 0,
168+
height: 0,
167169
operation: '',
168170
size_: this.size,
169171
lineHeight_: this.lineHeight,
@@ -233,6 +235,8 @@ export default {
233235
this.operation = ''
234236
},
235237
handlePanStart(event) {
238+
this.width = this.$refs.editable.offsetWidth
239+
this.height = this.$refs.editable.offsetHeight
236240
let coordinate
237241
if (event.type === 'mousedown') {
238242
coordinate = this.handleMousedown(event)

src/VuePdfEditor.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@
153153
:text="object.text"
154154
:x="object.x"
155155
:y="object.y"
156+
:width="object.width"
157+
:height="object.height"
156158
:show-line-size-select="showLineSizeSelect"
157159
:show-font-size-select="showFontSizeSelect"
158160
:show-font-select="showFontSelect"
@@ -598,7 +600,6 @@ export default {
598600
text,
599601
type: 'text',
600602
size: this.textDefaultSize,
601-
width: 0, // recalculate after editing
602603
lineHeight: 1.4,
603604
fontFamily: this.currentFont,
604605
canvasWidth,

0 commit comments

Comments
 (0)