Skip to content

Commit

Permalink
feat(troika-three-text): remove long-deprecated anchor array property
Browse files Browse the repository at this point in the history
  • Loading branch information
lojjic committed Mar 8, 2022
1 parent bf68d74 commit 752e302
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
4 changes: 0 additions & 4 deletions packages/troika-three-text/README.md
Expand Up @@ -85,10 +85,6 @@ The string of text to be rendered. Newlines and repeating whitespace characters

Default: _none_

### `anchor`

This property is deprecated as of version 0.24.0; use `anchorX` and `anchorY` instead.

### `anchorX`

Defines the horizontal position in the text block that should line up with the local origin. Can be specified as a numeric `x` position in local units, a string percentage of the total text block width e.g. `'25%'`, or one of the following keyword strings: `'left'`, `'center'`, or `'right'`.
Expand Down
32 changes: 0 additions & 32 deletions packages/troika-three-text/src/Text.js
Expand Up @@ -102,16 +102,6 @@ const Text = /*#__PURE__*/(() => {
*/
this.text = ''

/**
* @deprecated Use `anchorX` and `anchorY` instead
* @member {Array<number>} anchor
* Defines where in the text block should correspond to the mesh's local position, as a set
* of horizontal and vertical percentages from 0 to 1. A value of `[0, 0]` (the default)
* anchors at the top-left, `[1, 1]` at the bottom-right, and `[0.5, 0.5]` centers the
* block at the mesh's position.
*/
//this.anchor = null

/**
* @member {number|string} anchorX
* Defines the horizontal position in the text block that should line up with the local origin.
Expand Down Expand Up @@ -780,28 +770,6 @@ const Text = /*#__PURE__*/(() => {
})
})


// Deprecation handler for `anchor` array:
let deprMsgShown = false
Object.defineProperty(Text.prototype, 'anchor', {
get() {
return this._deprecated_anchor
},
set(val) {
this._deprecated_anchor = val
if (!deprMsgShown) {
console.warn('TextMesh: `anchor` has been deprecated; use `anchorX` and `anchorY` instead.')
deprMsgShown = true
}
if (Array.isArray(val)) {
this.anchorX = `${(+val[0] || 0) * 100}%`
this.anchorY = `${(+val[1] || 0) * 100}%`
} else {
this.anchorX = this.anchorY = 0
}
}
})

return Text
})()

Expand Down

0 comments on commit 752e302

Please sign in to comment.