sync display

This commit is contained in:
Richard Alam 2012-01-29 20:13:46 +00:00
parent 8d8441ad94
commit cdfc374cf2
2 changed files with 36 additions and 15 deletions

View File

@ -55,6 +55,7 @@
import org.bigbluebutton.common.IBbbCanvas; import org.bigbluebutton.common.IBbbCanvas;
import org.bigbluebutton.common.LogUtil; import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.main.events.MadePresenterEvent; import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.modules.present.events.CursorEvent; import org.bigbluebutton.modules.present.events.CursorEvent;
import org.bigbluebutton.modules.present.events.DisplaySlideEvent; import org.bigbluebutton.modules.present.events.DisplaySlideEvent;
@ -227,6 +228,7 @@
LogUtil.debug("Displaying viewed region"); LogUtil.debug("Displaying viewed region");
slideModel.displayRegion(slideModel.viewedRegionX, slideModel.viewedRegionY, slideModel.viewedRegionW, slideModel.viewedRegionH); slideModel.displayRegion(slideModel.viewedRegionX, slideModel.viewedRegionY, slideModel.viewedRegionW, slideModel.viewedRegionH);
fitSlideToLoader(); fitSlideToLoader();
notifyOthersOfZoomEvent();
} }
/** /**
@ -320,10 +322,10 @@
private function notifyOthersOfZoomEvent():void { private function notifyOthersOfZoomEvent():void {
var presentEvent:PresenterCommands = new PresenterCommands(PresenterCommands.ZOOM); var presentEvent:PresenterCommands = new PresenterCommands(PresenterCommands.ZOOM);
presentEvent.xOffset = slideLoader.x/slideLoader.width; presentEvent.xOffset = slideModel.viewedRegionX;
presentEvent.yOffset = slideLoader.y/slideLoader.height; presentEvent.yOffset = slideModel.viewedRegionY;
presentEvent.slideToCanvasWidthRatio = slideLoader.width/this.width; presentEvent.slideToCanvasWidthRatio = slideModel.viewedRegionW;
presentEvent.slideToCanvasHeightRatio = slideLoader.height/this.height; presentEvent.slideToCanvasHeightRatio = slideModel.viewedRegionH;
dispatchEvent(presentEvent); dispatchEvent(presentEvent);
} }
@ -336,24 +338,32 @@
* Handles notification from presenter that the slide has moved. * Handles notification from presenter that the slide has moved.
*/ */
private function handleMoveEvent(e:MoveEvent):void{ private function handleMoveEvent(e:MoveEvent):void{
savePresentersSettings(e.xOffset, e.yOffset, e.slideToCanvasWidthRatio, e.slideToCanvasHeightRatio); if (UserManager.getInstance().getConference().amIPresenter()) {
if (!isPresenter) { return;
resizeAndMoveLoaderInRelationToCanvas();
} }
LogUtil.debug("Got resizing event from presenter [" + e.xOffset + "," + e.yOffset + "," + e.slideToCanvasWidthRatio + "," + e.slideToCanvasHeightRatio + "]");
moveCanvas(slideLoader.x, slideLoader.y); slideModel.calculateViewportNeededForRegion(e.slideToCanvasWidthRatio, e.slideToCanvasHeightRatio);
slideModel.displayRegion(e.xOffset, e.yOffset, e.slideToCanvasWidthRatio, e.slideToCanvasHeightRatio);
fitSlideToLoader();
// savePresentersSettings(e.xOffset, e.xOffset, e.slideToCanvasWidthRatio, e.slideToCanvasHeightRatio);
// if (!isPresenter) {
// slideModel.displayRegion(e.xOffset, e.xOffset, e.slideToCanvasWidthRatio, e.slideToCanvasHeightRatio);
// }
//
// moveCanvas(slideLoader.x, slideLoader.y);
} }
/** /**
* Handle notification from presenter that the slide has been zoomed. * Handle notification from presenter that the slide has been zoomed.
*/ */
private function handleZoomEvent(e:ZoomEvent):void { private function handleZoomEvent(e:ZoomEvent):void {
savePresentersSettings(e.xOffset, e.yOffset, e.slideToCanvasWidthRatio, e.slideToCanvasHeightRatio); // LogUtil.debug("Got resizing event from presenter [" + e.xOffset + "," + e.yOffset + "," + e.slideToCanvasWidthRatio + "," + e.slideToCanvasHeightRatio + "]");
if (!isPresenter) { // savePresentersSettings(e.xOffset, e.yOffset, e.slideToCanvasWidthRatio, e.slideToCanvasHeightRatio);
resizeAndMoveLoaderInRelationToCanvas(); // if (!isPresenter) {
} // resizeAndMoveLoaderInRelationToCanvas();
// }
zoomCanvas(slideLoader.width, slideLoader.height); // zoomCanvas(slideLoader.width, slideLoader.height);
} }
/** /**

View File

@ -130,7 +130,7 @@ package org.bigbluebutton.modules.whiteboard.views.models
} }
} else { } else {
viewedRegionW = pageOrigW; viewedRegionW = pageOrigW;
viewedRegionH = (viewportH/viewportW) * pageOrigH; viewedRegionH = (viewportH/viewportW) * pageOrigH;
} }
} }
@ -229,5 +229,16 @@ package org.bigbluebutton.modules.whiteboard.views.models
LogUtil.debug("Displaying [" + loaderW + "," + loaderH + "] [" + loaderX + "," + loaderY + "]"); LogUtil.debug("Displaying [" + loaderW + "," + loaderH + "] [" + loaderX + "," + loaderY + "]");
} }
public function calculateViewportNeededForRegion(regionW:int, regionH:int):void {
viewportH = parentH;
viewportW = parentW;
if (parentW < parentH) {
viewportH = (regionH/regionW)*parentW;
} else {
viewportW = (regionW/regionH)*parentH;
}
}
} }
} }