diff --git a/src/components/audio-trimmer/audio-trimmer.css b/src/components/audio-trimmer/audio-trimmer.css index fe276c3819eed948b33d34cde90da60f19bca77f..3d9fa65a190ee08844f2079730346973e9bfd54a 100644 --- a/src/components/audio-trimmer/audio-trimmer.css +++ b/src/components/audio-trimmer/audio-trimmer.css @@ -12,6 +12,9 @@ $hover-scale: 2; left: 0; width: 100%; height: 100%; + + /* Force the browser to paint separately to avoid composite cost with waveform */ + transform: translateZ(0); } .trim-background { @@ -51,7 +54,15 @@ $hover-scale: 2; } .playhead { - border: 1px solid $motion-primary; + /* + Even though playhead is just a line, it is 100% width (the width of the waveform) + so that we can use transform: translateX() using percentages. + */ + width: 100%; + border-left: 1px solid $motion-primary; + border-top: none; + border-bottom: none; + border-right: none; } .start-trim-line { diff --git a/src/components/audio-trimmer/audio-trimmer.jsx b/src/components/audio-trimmer/audio-trimmer.jsx index d1b21c92664cebc586212c9833629ba90da8f701..e2ad295fc09ff22c5725eb0285234f5f419a212f 100644 --- a/src/components/audio-trimmer/audio-trimmer.jsx +++ b/src/components/audio-trimmer/audio-trimmer.jsx @@ -35,7 +35,7 @@ const AudioTrimmer = props => ( <Box className={classNames(styles.trimLine, styles.playhead)} style={{ - left: `${100 * props.playhead}%` + transform: `translateX(${100 * props.playhead}%)` }} /> ) : null} diff --git a/test/unit/components/__snapshots__/sound-editor.test.jsx.snap b/test/unit/components/__snapshots__/sound-editor.test.jsx.snap index 93ebc2cf68c794ad31bbf93e6f61b6ec5ac440b5..77df3c54966667bf29f37063ce62d857ed95c2c9 100644 --- a/test/unit/components/__snapshots__/sound-editor.test.jsx.snap +++ b/test/unit/components/__snapshots__/sound-editor.test.jsx.snap @@ -224,7 +224,7 @@ exports[`Sound Editor Component matches snapshot 1`] = ` "flexWrap": undefined, "height": undefined, "justifyContent": undefined, - "left": "50%", + "transform": "translateX(50%)", "width": undefined, } }