stop sending redundant slide pos updates

This commit is contained in:
Chad Pilkey 2017-06-08 18:38:43 -04:00
parent e7a2e3d70b
commit e1a50bed32
2 changed files with 40 additions and 23 deletions

View File

@ -178,11 +178,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
var deltaCanvasMouseY:Number = this.mouseY - prevMouseY;
prevMouseX = this.mouseX;
prevMouseY = this.mouseY;
slideModel.onMove(deltaCanvasMouseX, deltaCanvasMouseY);
slideModel.printViewedRegion();
slideModel.displayPresenterView();
fitSlideToLoader();
notifyOthersOfZoomEvent();
var xyChange:Boolean = slideModel.onMove(deltaCanvasMouseX, deltaCanvasMouseY);
if (xyChange) {
slideModel.printViewedRegion();
slideModel.displayPresenterView();
fitSlideToLoader();
notifyOthersOfZoomEvent();
}
}
/**
@ -232,12 +234,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
* Triggered when the presenter uses the mouse wheel to zoom in/out of the slide.
*/
private function onMouseWheelZoomEvent(e:MouseEvent):void {
var newZoomPercentage:Number = zoomPercentage;
if (presenterIsZoomingOut(e.delta)) {
zoomPercentage -= ZOOM_STEP;
newZoomPercentage -= ZOOM_STEP;
} else {
zoomPercentage += ZOOM_STEP;
newZoomPercentage += ZOOM_STEP;
}
zoomSlide(zoomPercentage, this.mouseX, this.mouseY);
zoomSlide(newZoomPercentage, this.mouseX, this.mouseY);
}
public function switchToFitToPage(ftp:Boolean):void {
@ -251,17 +254,21 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function zoomSlide(zoom:Number, mouseX:Number, mouseY:Number):void {
zoomPercentage = zoom;
if (zoomPercentage <= SlideViewModel.HUNDRED_PERCENT) {
zoomPercentage = SlideViewModel.HUNDRED_PERCENT;
} else if (zoomPercentage >= SlideViewModel.MAX_ZOOM_PERCENT) {
zoomPercentage = SlideViewModel.MAX_ZOOM_PERCENT
if (zoom <= SlideViewModel.HUNDRED_PERCENT) {
zoom = SlideViewModel.HUNDRED_PERCENT;
} else if (zoom >= SlideViewModel.MAX_ZOOM_PERCENT) {
zoom = SlideViewModel.MAX_ZOOM_PERCENT
}
if (zoom != zoomPercentage) {
zoomPercentage = zoom;
slideModel.onZoom(zoomPercentage, mouseX, mouseY);
slideModel.printViewedRegion();
slideModel.displayPresenterView();
fitSlideToLoader();
notifyOthersOfZoomEvent();
}
slideModel.onZoom(zoomPercentage, mouseX, mouseY);
slideModel.printViewedRegion();
slideModel.displayPresenterView();
fitSlideToLoader();
notifyOthersOfZoomEvent();
}
private function notifyOthersOfZoomEvent():void {

View File

@ -150,7 +150,7 @@ package org.bigbluebutton.modules.present.ui.views.models
_calcPageW = (viewportW/_viewedRegionW) * HUNDRED_PERCENT;
_calcPageH = (_pageOrigH/_pageOrigW) * _calcPageW;
calcViewedRegion();
onResizeMove();
doBoundsValidation();
}
}
@ -186,17 +186,27 @@ package org.bigbluebutton.modules.present.ui.views.models
}
}
private function onResizeMove():void {
private function doBoundsValidation():void {
doWidthBoundsDetection();
doHeightBoundsDetection();
}
public function onMove(deltaX:Number, deltaY:Number):void {
/** Returns whether or not the page actually moved */
public function onMove(deltaX:Number, deltaY:Number):Boolean {
var oldX:Number = _calcPageX;
var oldY:Number = _calcPageY;
_calcPageX += deltaX / MYSTERY_NUM;
_calcPageY += deltaY / MYSTERY_NUM;
onResizeMove();
calcViewedRegion();
doBoundsValidation();
if (oldX != _calcPageX || oldY != _calcPageY) {
calcViewedRegion();
return true;
} else {
return false;
}
}
public function calculateViewportSize():void {