diff --git a/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.idx b/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.idx similarity index 98% rename from pr-preview/pr-70/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.idx rename to pr-preview/pr-70/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.idx index f0ad81a0..a115939c 100644 Binary files a/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.idx and b/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.idx differ diff --git a/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.pack b/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.pack similarity index 99% rename from pr-preview/pr-70/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.pack rename to pr-preview/pr-70/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.pack index d3aa6714..32e760c1 100644 Binary files a/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.pack and b/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.pack differ diff --git a/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.rev b/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.rev similarity index 91% rename from pr-preview/pr-70/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.rev rename to pr-preview/pr-70/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.rev index e75cea26..e8974c33 100644 Binary files a/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-cee964a1e325ed338ecd63a990839efa6ecdd023.rev and b/pr-preview/pr-70/bare_pr_preview/objects/pack/pack-fd5e4e256db2022cde860fee7431094e5989400b.rev differ diff --git a/pr-preview/pr-70/js/draw/scroll.js b/pr-preview/pr-70/js/draw/scroll.js index 835fe197..dada3dd7 100644 --- a/pr-preview/pr-70/js/draw/scroll.js +++ b/pr-preview/pr-70/js/draw/scroll.js @@ -10,6 +10,7 @@ const scrollBars = { verticalThumb: null, prevVerticalY: NaN, currentFunction: null, + objects: null, }; export const scrollTopLeft = () => { @@ -37,21 +38,16 @@ export const setScroll = (x, y) => { container.position.set(x, y); }; -function startDragHorizontalThumb(event, objects) { +function startDragHorizontalThumb(event) { const app = getApp(); scrollBars.prevHorizontalX = event.data.global.x - scrollBars.horizontalThumb.width / 2; - const moveFunction = (event) => { - moveHorizontalThumb(event, objects); - }; - - scrollBars.currentFunction = moveFunction; - app.stage.on("pointermove", moveFunction); + app.stage.on("pointermove", moveHorizontalThumb); } -function moveHorizontalThumb(event, objects) { +function moveHorizontalThumb(event) { const horizontalScrollBar = scrollBars.horizontalThumb; const app = getApp(); const container = getContainer(); @@ -72,29 +68,25 @@ function moveHorizontalThumb(event, objects) { scrollBars.prevHorizontalX = newThumbX; } + const { objects } = scrollBars; setRenderable(objects); } function stopHorizontalThumbDrag() { const app = getApp(); - app.stage.off("pointermove", scrollBars.currentFunction); + app.stage.off("pointermove", moveHorizontalThumb); } -function startDragVerticalThumb(event, objects) { +function startDragVerticalThumb(event) { const app = getApp(); scrollBars.prevVerticalY = event.data.global.y - scrollBars.verticalThumb.height / 2; - const moveFunction = (event) => { - moveVerticalThumb(event, objects); - }; - - scrollBars.currentFunction = moveFunction; - app.stage.on("pointermove", moveFunction); + app.stage.on("pointermove", moveVerticalThumb); } -function moveVerticalThumb(event, objects) { +function moveVerticalThumb(event) { const verticalScrollBar = scrollBars.verticalThumb; const app = getApp(); const container = getContainer(); @@ -115,15 +107,16 @@ function moveVerticalThumb(event, objects) { scrollBars.prevVerticalY = newThumbY; } + const { objects } = scrollBars; setRenderable(objects); } function stopVerticalThumbDrag() { const app = getApp(); - app.stage.off("pointermove", scrollBars.currentFunction); + app.stage.off("pointermove", moveVerticalThumb); } -const addScrollBars = (app, container, objects) => { +const addScrollBars = (app, container) => { const scrollBarColor = "#e1e1e1"; const renderer = app.renderer; const rendererWidth = renderer.width; @@ -200,17 +193,13 @@ const addScrollBars = (app, container, objects) => { horizontalThumb.eventMode = "static"; horizontalThumb.interactiveChildren = false; - horizontalThumb.on("pointerdown", (event) => { - startDragHorizontalThumb(event, objects); - }); + horizontalThumb.on("pointerdown", startDragHorizontalThumb); verticalThumb.cursor = "pointer"; verticalThumb.eventMode = "static"; verticalThumb.interactiveChildren = false; - verticalThumb.on("pointerdown", (event) => { - startDragVerticalThumb(event, objects); - }); + verticalThumb.on("pointerdown", startDragVerticalThumb); setScrollBarsPosition(); }; @@ -254,7 +243,8 @@ export const addScroll = (app, objects) => { const screenWidth = renderer.width; const screenHeight = renderer.height; - addScrollBars(app, container, objects); + scrollBars.objects = objects; + addScrollBars(app, container); app.stage.on("pointerup", stopHorizontalThumbDrag); app.stage.on("pointerupoutside", stopHorizontalThumbDrag);