Skip to content

Commit

Permalink
Merge pull request #2602 from Azmoria/Performance---player-view-scree…
Browse files Browse the repository at this point in the history
…n-scroll-should-be-smoother-

Performance - player view scrolling should be smoother - especially when scrolling by drag.
  • Loading branch information
Azmoria authored Oct 25, 2024
2 parents ad60dfa + 35f746f commit 89bd9eb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function change_zoom(newZoom, x, y, reset = false) {
let pageX = Math.round(centerX * window.ZOOM - zoomCenterX) + window.VTTMargin;
let pageY = Math.round(centerY * window.ZOOM - zoomCenterY) + window.VTTMargin;

if($('#projector_zoom_lock.enabled > [class*="is-active"]').length>0)
if($('#projector_zoom_lock.enabled > [class*="is-active"]').length>0 && window.DM)
$(window).off('scroll.projectorMode')


Expand Down Expand Up @@ -226,7 +226,7 @@ function change_zoom(newZoom, x, y, reset = false) {


$(".peerCursorPosition").css("transform", "scale(" + 1/window.ZOOM + ")");
if($('#projector_zoom_lock.enabled > [class*="is-active"]').length>0)
if($('#projector_zoom_lock.enabled > [class*="is-active"]').length>0 && window.DM)
debounce_scroll_event()


Expand Down
8 changes: 7 additions & 1 deletion Startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ $(function() {
init_loading_overlay_beholder();
addBeyond20EventListener("rendered-roll", (request) => {$('.avtt-sidebar-controls #switch_gamelog').click();});
$('meta[name="viewport"]').attr('content', 'width=device-width, initial-scale=1.0, user-scalable=no')
$(window).off('scroll.projectorMode').on("scroll.projectorMode", projector_scroll_event);
startup_step("Gathering basic campaign info");
harvest_game_id() // find our campaign id
.then(set_game_id) // set it to window.gameId
Expand Down Expand Up @@ -441,6 +440,7 @@ async function start_above_vtt_for_dm() {
window.MB.sendMessage("custom/myVTT/DMAvatar", {
avatar: dmAvatarUrl
})
$(window).off('scroll.projectorMode').on("scroll.projectorMode", projector_scroll_event);
remove_loading_overlay();
}

Expand Down Expand Up @@ -479,6 +479,12 @@ async function start_above_vtt_for_players() {
}
});

/*prevents repainting due to ddb adjusting player sheet classes and throttling it*/
document.addEventListener('scroll', function(e) {
e.preventDefault();
e.stopImmediatePropagation();
}, true);

startup_step("Fetching scene from AboveVTT server");
const currentSceneData = await AboveApi.getCurrentScene();
if (currentSceneData.playerscene) {
Expand Down
12 changes: 12 additions & 0 deletions abovevtt.css
Original file line number Diff line number Diff line change
Expand Up @@ -4405,6 +4405,18 @@ div#initialPosition_row input::-webkit-inner-spin-button {
margin: 0;
}

/*do our own css of mobile character sheets due to disabling ddb event that changes classes*/
.ct-character-sheet-mobile__header{
position: sticky !important;
top: -73px !important;
}
.ct-character-sheet-mobile{
padding-top:0px !important;
}
.ct-combat-mobile{
position: sticky !important;
top: 0px !important;
}

div#initialPosition_row input[type=number] {
-moz-appearance: textfield;
Expand Down

0 comments on commit 89bd9eb

Please sign in to comment.