修复时间线组件的pxPerFrame变量在setZoom函数调用前被修改导致setZoom函数失效的bug
This commit is contained in:
parent
f4411ac5d3
commit
7f1c63aaf4
|
|
@ -101,10 +101,11 @@ export function useTimeline(
|
|||
|
||||
function setZoom(value: number): void {
|
||||
const oldPxPerFrame = pxPerFrame.value
|
||||
const newPxPerFrame = Math.max(minPxPerFrame.value, Math.min(value, maxPxPerFrame.value))
|
||||
const newPxPerFrame = Math.max(minPxPerFrame.value, Math.min(maxPxPerFrame.value, value))
|
||||
|
||||
if (oldPxPerFrame === newPxPerFrame || !timelineContainer.value)
|
||||
if (oldPxPerFrame === newPxPerFrame || !timelineContainer.value) {
|
||||
return
|
||||
}
|
||||
|
||||
const container = timelineContainer.value
|
||||
const containerWidth = container.clientWidth
|
||||
|
|
@ -116,6 +117,7 @@ export function useTimeline(
|
|||
&& playheadPosition <= containerScrollLeft + containerWidth
|
||||
|
||||
// 计算缩放前后的位置偏移
|
||||
// console.log('container.scrollLeft', container.scrollLeft)
|
||||
if (playheadVisible) {
|
||||
// 以播放头为中心缩放
|
||||
const playheadX = playheadPosition - containerScrollLeft
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ onUnmounted(() => {
|
|||
</el-text>
|
||||
</div>
|
||||
<ElSlider
|
||||
v-model="pxPerFrame"
|
||||
:model-value="pxPerFrame"
|
||||
:min="minPxPerFrame"
|
||||
:max="maxPxPerFrame"
|
||||
:step="0.1"
|
||||
|
|
|
|||
Loading…
Reference in New Issue