From 970ca11b617d73c8fd8a0d64d8f2a439f86c2ddd Mon Sep 17 00:00:00 2001 From: Denis Zgonjanin Date: Fri, 8 Jan 2010 23:52:23 +0000 Subject: [PATCH] - Initial stuff to support text selection on slides - Pointer sync issue still unresolved, but happens only when moving slide git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@3245 af16638f-c34d-0410-8cfa-b39d5352b314 --- .../modules/present/views/SlideView.mxml | 148 ++++++++++++------ 1 file changed, 102 insertions(+), 46 deletions(-) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/views/SlideView.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/present/views/SlideView.mxml index 12305ae469..ef4d21051e 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/views/SlideView.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/views/SlideView.mxml @@ -27,18 +27,20 @@ xmlns:panzoom="com.adobe.wheelerstreet.fig.panzoom.*" xmlns:local="*" resize="onResize()" xmlns:mate="http://mate.asfusion.com/" rollOut="hideCursor()"> - - - + + + - - - - - + + + + + + 1 && e.yPercent > 1) || (cursor.x > this.width || cursor.y > this.height)) cursor.visible = false; else cursor.visible = true; } - private function isCursorOffWindow(e:CursorEvent):Boolean { - return (e.xPercent > 1 && e.yPercent > 1) || (cursor.x > this.width || cursor.y > this.height); - } - private function hideCursor():void{ cursor.visible = false; } + public function turnOnTextSelection():void{ + slideClip = myLoader.content as MovieClip; + slideText = slideClip.textSnapshot; + myLoader.addEventListener(MouseEvent.MOUSE_DOWN, onTextMouseDown); + myLoader.addEventListener(MouseEvent.MOUSE_UP, onTextMouseUp); + myLoader.addEventListener(MouseEvent.MOUSE_OUT, onTextMouseOut); + slideText.setSelected(0, slideText.charCount, true); + } + + private function onTextMouseDown(e:MouseEvent):void{ + myLoader.addEventListener(MouseEvent.MOUSE_MOVE, onTextMouseMove); + slideText.setSelectColor(0xFFFF00); + firstChar = slideText.hitTestTextNearPos(slideClip.mouseX, slideClip.mouseY, 0); + slideText.setSelected(0, slideText.charCount, false); + } + + private function onTextMouseMove(e:MouseEvent):void{ + if (firstChar != -1){ + slideText.setSelected(0, slideText.charCount, false) + + lastChar = slideText.hitTestTextNearPos(slideClip.mouseX, slideClip.mouseY, 0); + if (firstChar < lastChar){ + slideText.setSelected(firstChar, lastChar + 1, true); + } else{ + slideText.setSelected(lastChar, firstChar + 1, true); + } + } + } + + private function onTextMouseUp(e:MouseEvent):void{ + myLoader.removeEventListener(MouseEvent.MOUSE_MOVE, onTextMouseMove); + + if (firstChar >= 0){ + lastChar = slideText.hitTestTextNearPos(slideClip.mouseX, slideClip.mouseY, 0); + if (firstChar != lastChar){ + if (firstChar < lastChar){ + slideText.setSelected(firstChar, lastChar + 1, true); + } else{ + slideText.setSelected(lastChar, firstChar + 1, true); + } + } + firstChar = -1; + lastChar = -1; + } + myLoader.removeEventListener(MouseEvent.MOUSE_OUT, onTextMouseOut); + myLoader.removeEventListener(MouseEvent.MOUSE_MOVE, onTextMouseMove); + } + + private function onTextMouseOut(e:MouseEvent):void{ + myLoader.removeEventListener(MouseEvent.MOUSE_MOVE, onTextMouseMove); + slideText.setSelected(0, slideText.charCount, false); + } + ]]> - +