Skip to content

Commit

Permalink
Merge pull request #117 from LibreSign/fix/get-width-and-height-of-te…
Browse files Browse the repository at this point in the history
…xt-item

fix: get width and height of text item
  • Loading branch information
vitormattos authored Nov 18, 2024
2 parents 28fed94 + 09a760f commit bc88961
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Components/TextItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export default {
// editable: null,
dx: 0,
dy: 0,
width: 0,
height: 0,
operation: '',
size_: this.size,
lineHeight_: this.lineHeight,
Expand Down Expand Up @@ -233,6 +235,8 @@ export default {
this.operation = ''
},
handlePanStart(event) {
this.width = this.$refs.editable.offsetWidth
this.height = this.$refs.editable.offsetHeight
let coordinate
if (event.type === 'mousedown') {
coordinate = this.handleMousedown(event)
Expand Down
3 changes: 2 additions & 1 deletion src/VuePdfEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
:text="object.text"
:x="object.x"
:y="object.y"
:width="object.width"
:height="object.height"
:show-line-size-select="showLineSizeSelect"
:show-font-size-select="showFontSizeSelect"
:show-font-select="showFontSelect"
Expand Down Expand Up @@ -598,7 +600,6 @@ export default {
text,
type: 'text',
size: this.textDefaultSize,
width: 0, // recalculate after editing
lineHeight: 1.4,
fontFamily: this.currentFont,
canvasWidth,
Expand Down

0 comments on commit bc88961

Please sign in to comment.