fix length gauge

This commit is contained in:
Nolan Lawson 2018-03-12 10:06:41 -07:00
parent 1603c7a13b
commit 136ec67d61

View file

@ -1,5 +1,5 @@
<div class="compose-box-length-gauge {{shouldAnimate ? 'should-animate' : ''}} {{overLimit ? 'over-char-limit' : ''}}"
style="transform: scaleX({{inputLengthAsFractionRoundedAfterRaf || 0}});"
style="transform: scaleX({{lengthAsFractionRoundedAfterRaf || 0}});"
aria-hidden="true"
></div>
<style>
@ -25,11 +25,11 @@
export default {
oncreate() {
// perf improvement for keyboard input latency
this.observe('inputLengthAsFractionRounded', inputLengthAsFractionRounded => {
this.observe('lengthAsFractionRounded', lengthAsFractionRounded => {
requestAnimationFrame(() => {
mark('set inputLengthAsFractionRoundedAfterRaf')
this.set({inputLengthAsFractionRoundedAfterRaf: inputLengthAsFractionRounded})
stop('set inputLengthAsFractionRoundedAfterRaf')
mark('set lengthAsFractionRoundedAfterRaf')
this.set({lengthAsFractionRoundedAfterRaf: lengthAsFractionRounded})
stop('set lengthAsFractionRoundedAfterRaf')
requestAnimationFrame(() => this.set({shouldAnimate: true}))
})
})