Author: solomax
Date: Wed Oct 12 06:56:19 2016
New Revision: 1764392

URL: http://svn.apache.org/viewvc?rev=1764392&view=rev
Log:
[OPENMEETINGS-1482] WB drawing should be more smooth

Modified:
    
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDraw.lzx
    
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDrawImage.lzx
    
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/tools/baseDrawPaint.lzx
    
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDraw.lzx
    
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDrawImage.lzx
    
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/tools/baseDrawPaint.lzx

Modified: 
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDraw.lzx
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDraw.lzx?rev=1764392&r1=1764391&r2=1764392&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDraw.lzx
 (original)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDraw.lzx
 Wed Oct 12 06:56:19 2016
@@ -25,6 +25,7 @@
                <when property="$as3">
                        <passthrough>
                                import flash.printing.PrintJob;
+                               import flash.events.MouseEvent;
                        </passthrough>
                </when>
        </switch>
@@ -63,6 +64,7 @@
        <attribute name="selectedObjects" value="null"/>
 
        <attribute name="ObjectByName" value="null" />
+       <attribute name="originalFrameRate" type="number" value="0"/>
 
        <method name="getCounter">
                //Debug.write("### getCounter :",this.counter);
@@ -70,20 +72,6 @@
                return "_"+now.getTime();
        </method>
 
-       <!--
-        not needed anymore, Issue 507
-       <netRemoteCallHib name="getOID" funcname="getOID" showLoading="false"
-                                       remotecontext="$once{ canvas.thishib }" 
> 
-               <handler name="ondata" args="value">
-                       <![CDATA[
-                               //The onResult-Handler will be called be the 
rtmpconnection
-                               if($debug) Debug.write("getOID: ",value);
-                               parent.counter = value;
-                       ]]>
-               </handler>   
-       </netRemoteCallHib>      
-        -->
-
        <method name="compareAndSetCounter" args="c">
                <![CDATA[
                        if (c>this.counter) this.counter = c;
@@ -533,7 +521,7 @@
        </method>
 
        <method name="onmousedownMethod" >
-               <![CDATA[
+       <![CDATA[
                if ($debug) Debug.write("onmousedownMethod this.drawmodus: 
",this.drawmodus);
 
                if(this.selectedObjects != null && this.selectedObjects.length 
> 0){
@@ -559,7 +547,10 @@
                                this.doSetHandBodus();
                        } else if(this.drawmodus=="paint"){
                                this.startPaint();
-                               mousetracker_del.register(lz.Idle,'onidle');
+                               originalFrameRate = 
canvas.sprite.stage.frameRate;
+                               canvas.sprite.stage.frameRate = 60;
+                               if ($debug) Debug.write("Current FPS: ", 
canvas.sprite.stage.frameRate);
+                               
canvas.sprite.stage.addEventListener(MouseEvent.MOUSE_MOVE, drawLine);
                        } else if(this.drawmodus=="line"){
                                this.startLine(null);
                                this.startx = currentlayer.getMouse('x');
@@ -614,91 +605,96 @@
                                startTyping();
                        }
                }
-               ]]>
+       ]]>
+       </method>
+
+       <method name="drawLine" args="e">
+               //fake
        </method>
 
        <method name="onmouseupMethod" >
+       <![CDATA[
                if ($debug) Debug.write("onmouseupMethod this.drawmodus: 
",this.drawmodus);
-               <![CDATA[
-                       if (canvas.ismoderator || canvas.isAllowedToDraw) {
+               if (canvas.ismoderator || canvas.isAllowedToDraw) {
 
-                               var knownModus = true;
-                               if(this.drawmodus=="drag"){
-                                       this.isDragging = false;
-                                       this.dragger.remove();
-
-                                       
this.setAttribute("x",Math.round(this.x));
-                                       
this.setAttribute("y",Math.round(this.y));
-
-                                       if (this.last_x == this.x && 
this.last_x == this.x) {
-                                               if ($debug) Debug.write("No 
Change");
-                                               return;
-                                       }
+                       var knownModus = true;
+                       if(this.drawmodus=="drag"){
+                               this.isDragging = false;
+                               this.dragger.remove();
 
-                                       this.last_x = this.x;
-                                       this.last_y = this.y;
+                               this.setAttribute("x",Math.round(this.x));
+                               this.setAttribute("y",Math.round(this.y));
 
-                                       var tArray = new Array();
-                                       tArray[0] = "moveMap";
-                                       tArray[1] = this.x;
-                                       tArray[2] = this.y;
-
-                                       this.onsharedMessage('moveMap',tArray);
-
-                               } else if(this.drawmodus=="paint"){
-                                       this.endPaint();
-                                       mousetracker_del.unregisterAll();
-                               } else if(this.drawmodus=="line"){
-                                       this.endLine();
-                                       mousetracker_del.unregisterAll();
-                               } else if(this.drawmodus=="drawarrow"){
-                                       this.endDrawarrowline();
-                                       mousetracker_del.unregisterAll();
-                               } else if(this.drawmodus=="uline"){
-                                       this.endUline();
-                                       mousetracker_del.unregisterAll();
-                               } else if(this.drawmodus=="letter"){
-                                       this.endLetter();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'rectangle') {
-                                       this.endRect();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'ellipse') {
-                                       this.endEllipse();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'pointer') {
-                                       this.setAttribute('drawmodus','hand');
-                                       if (this.boundingIsActive){
-                                               
this.boundingref._innerDrag.onmouseup.sendEvent();
-                                       }
-                               } else if (this.drawmodus == 
'pointerWhiteboard') {
-                                       if ($debug) 
Debug.write("pointerWhiteboard set New Point ");
-                                       this.endPointerWhiteBoard();
-                               } else if(this.drawmodus=="clipart"){
-                                       this.endDrawClipArt();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'triangle') {
-                                       this.endTriangle();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'hand') {
-                                       this.endSelect();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'paste') {
-                               } else {
-                                       knownModus = true;
-                                       if ($debug) 
Debug.write("onmouseupMethod Unkown Modus ",this.drawmodus);
-                               }
-                               if (knownModus && !this.boundingIsActive && 
!this.letterObjectIsActive) {
-                                       endTyping();
+                               if (this.last_x == this.x && this.last_x == 
this.x) {
+                                       if ($debug) Debug.write("No Change");
+                                       return;
                                }
 
-                               this.checkStepLayers();
+                               this.last_x = this.x;
+                               this.last_y = this.y;
+
+                               var tArray = new Array();
+                               tArray[0] = "moveMap";
+                               tArray[1] = this.x;
+                               tArray[2] = this.y;
+
+                               this.onsharedMessage('moveMap',tArray);
+
+                       } else if(this.drawmodus=="paint"){
+                               canvas.sprite.stage.frameRate = 
originalFrameRate;
+                               
canvas.sprite.stage.addEventListener(MouseEvent.MOUSE_MOVE, drawLine);
+                               this.endPaint();
+                       } else if(this.drawmodus=="line"){
+                               this.endLine();
+                               mousetracker_del.unregisterAll();
+                       } else if(this.drawmodus=="drawarrow"){
+                               this.endDrawarrowline();
+                               mousetracker_del.unregisterAll();
+                       } else if(this.drawmodus=="uline"){
+                               this.endUline();
+                               mousetracker_del.unregisterAll();
+                       } else if(this.drawmodus=="letter"){
+                               this.endLetter();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'rectangle') {
+                               this.endRect();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'ellipse') {
+                               this.endEllipse();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'pointer') {
+                               this.setAttribute('drawmodus','hand');
+                               if (this.boundingIsActive){
+                                       
this.boundingref._innerDrag.onmouseup.sendEvent();
+                               }
+                       } else if (this.drawmodus == 'pointerWhiteboard') {
+                               if ($debug) Debug.write("pointerWhiteboard set 
New Point ");
+                               this.endPointerWhiteBoard();
+                       } else if(this.drawmodus=="clipart"){
+                               this.endDrawClipArt();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'triangle') {
+                               this.endTriangle();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'hand') {
+                               this.endSelect();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'paste') {
                        } else {
-                               if (!this.restricted) {
-                                       this.endPointerWhiteBoard();
-                               }
+                               knownModus = true;
+                               if ($debug) Debug.write("onmouseupMethod Unkown 
Modus ",this.drawmodus);
                        }
-               ]]>
+                       if (knownModus && !this.boundingIsActive && 
!this.letterObjectIsActive) {
+                               endTyping();
+                       }
+
+                       this.checkStepLayers();
+               } else {
+                       if (!this.restricted) {
+                               this.endPointerWhiteBoard();
+                       }
+               }
+       ]]>
        </method>
 
        <method name="startTyping">
@@ -721,16 +717,11 @@
                canvas.thishib.sendMessage.doCall();
        </method>
 
-       <!--
-       <handler name="onclick" args="obj">
-               //Debug.write("click on whiteBoard ",obj);
-       </handler>
-        -->
        <method name="trackmouse" args="item">
-               <![CDATA[
-
+       <![CDATA[
                this.mx = currentlayer.getMouse('x');
                this.my = currentlayer.getMouse('y');
+               //if ($debug) Debug.info("..trackmouse ", mx, my, item);
 
                if (this.drawmodus=="paint") {
                        if (mx != prevx || my != prevy) {
@@ -826,8 +817,7 @@
                        this.endy = this.my;
                        this.drawrectangle (this.startx, this.starty, this.mx, 
this.my);
                }
-
-               ]]>
+       ]]>
        </method>
 
        <!-- ####################

Modified: 
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDrawImage.lzx
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDrawImage.lzx?rev=1764392&r1=1764391&r2=1764392&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDrawImage.lzx
 (original)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDrawImage.lzx
 Wed Oct 12 06:56:19 2016
@@ -61,7 +61,6 @@
 
        <!--
                alterModus => this is added by the mod not remotely
-               
         -->
        <method name="addImageToLayer" 
args="obj,nameing,urlname,posx,posy,width,height,alterModus,baseurl,fileName,moduleName,parentPath,room,domain,uniqueObjectSyncName,isLocalSync">
                <![CDATA[
@@ -184,7 +183,7 @@
                
this.doSWFDocumentStatus(this.currentlayer,actionObject[actionObject.length-7]);
        </method>
 
-       <!--- 
+       <!---
                invoke by the initial Loading process in remoteWhiteboard.lzx, 
                does not invoke any Update Handler
                once this object is loaded, it will throw an Update event of 
kind

Modified: 
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/tools/baseDrawPaint.lzx
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/tools/baseDrawPaint.lzx?rev=1764392&r1=1764391&r2=1764392&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/tools/baseDrawPaint.lzx
 (original)
+++ 
openmeetings/application/branches/3.1.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/tools/baseDrawPaint.lzx
 Wed Oct 12 06:56:19 2016
@@ -19,30 +19,39 @@
   
 -->
 <library>
-
        <class name="baseDrawPaint" extends="baseDraw" >
-    
+               <switch>
+                       <when property="$as3">
+                               <passthrough>
+                                       import flash.geom.Point;
+                               </passthrough>
+                       </when>
+               </switch>
                <!-- paint -->
                <attribute name="currentlayerstroke" value="0xFF6600" />
                <attribute name="currentlayerlineWidth" value="2" type="number" 
/>
                <attribute name="currentlayerOpacity" value="1" type="number" />
-    
-               <!-- TODO: Check if needed, seems to have no reference -->
-               <attribute name="painttrans" value="false" type="boolean" />
-          
-               <!-- #####################
-                               Paint
-                        -->
-    
+               <attribute name="minx" value="0" type="number" />
+               <attribute name="miny" value="0" type="number" />
+               <attribute name="maxx" value="0" type="number" />
+               <attribute name="maxy" value="0" type="number" />
+               <attribute name="g" type="object"/>
+               <attribute name="points" type="object"/>
+
                <method name="drawline" args="x1,y1,x2,y2">
-               <![CDATA[
-                       currentlayer.beginPath();
-                       currentlayer.moveTo(x1, y1);
-                       currentlayer.lineTo(x2, y2);
-                       currentlayer.stroke();
-               ]]>
+                       drawlineOnObject(currentlayer, x1, y1, x2, y2);
+               </method>
+
+               <method name="drawLine" args="e">
+                       var p = new Point(currentlayer.getMouse('x'), 
currentlayer.getMouse('y'));
+                       g.lineTo(p.x, p.y);
+                       points.push(p);
+                       minx = Math.min(p.x, minx);
+                       maxx = Math.max(p.x, maxx);
+                       miny = Math.min(p.y, miny);
+                       maxy = Math.max(p.y, maxy);
                </method>
-    
+
                <method name="drawlineOnObject" args="obj,x1,y1,x2,y2">
                <![CDATA[
                        obj.beginPath();
@@ -51,20 +60,13 @@
                        obj.stroke();
                ]]>
                </method>
-        
-    
+
                <method name="drawlineRegisterPaint" args="x1,y1,x2,y2">
-                       var actionObject = new Array();
-                       actionObject[0] = 'point';
-                       actionObject[1] = x1;
-                       actionObject[2] = y1;
-                       actionObject[3] = x2;
-                       actionObject[4] = y2;
-                       this.basetempactionobjectList.push(actionObject);
-               </method> 
-         
-               <method name="startPaint">
+                       this.basetempactionobjectList.push(['point', x1, y1, 
x2, y2]);
+               </method>
 
+               <method name="startPaint">
+               <![CDATA[
                        //Debug.write("startPaint ",this.startx,this.starty);
                        this.currentlayer = new lz.drawViewNew(this, {
                                                name : 'paint' + 
this.getCounter(),
@@ -89,104 +91,58 @@
                        currentlayer.lineWidth = this.currentlayerlineWidth;
                        currentlayer.fillstyle = '0x000000';
 
-                       this.basetempactionobjectList = new Array();
-
-                       //beginFill( the_colorpicker.selectedColor );
+                       minx = this.width + 2;
+                       miny = this.height + 2;
+                       maxx = -2;
+                       maxy = -2;
+                       points = new Array();
+                       g = currentlayer.__drawcontext.graphics;
+                       g.lineStyle(currentlayer.lineWidth, 
currentlayer.strokeStyle);
+                       var p = new Point(currentlayer.getMouse('x'), 
currentlayer.getMouse('y'));
+                       points.push(p)
+                       g.moveTo(p.x, p.y);
+               ]]>
                </method>
 
                <method name="endPaint">
-        ////Debug.write("endPaint");
                <![CDATA[
+                       if ($debug) Debug.write("endPaint:: ", minx, miny, 
points);
                        var tempName = this.currentlayer.name;
                        this.currentlayer.destroy();
+                       this.basetempactionobjectList = new Array();
 
-                       //GetBounds of that Object
-                       var minx = this.width + 2;
-                       var miny = this.height + 2;
-                       var maxx = -2;
-                       var maxy = -2;
-
-                       for (var eg = 0; eg < 
this.basetempactionobjectList.length; eg++) {
-                               
////Debug.write(this.basetempactionobjectList[eg][1],this.basetempactionobjectList[eg][3]);
-                               if (this.basetempactionobjectList[eg][1] < minx)
-                                       minx = 
this.basetempactionobjectList[eg][1];
-                               if (this.basetempactionobjectList[eg][3] < minx)
-                                       minx = 
this.basetempactionobjectList[eg][3];
-
-                               if (this.basetempactionobjectList[eg][1] > maxx)
-                                       maxx = 
this.basetempactionobjectList[eg][1];
-                               if (this.basetempactionobjectList[eg][3] > maxx)
-                                       maxx = 
this.basetempactionobjectList[eg][3];
-
-                               if (this.basetempactionobjectList[eg][2] < miny)
-                                       miny = 
this.basetempactionobjectList[eg][2];
-                               if (this.basetempactionobjectList[eg][4] < miny)
-                                       miny = 
this.basetempactionobjectList[eg][4];
-
-                               if (this.basetempactionobjectList[eg][2] > maxy)
-                                       maxy = 
this.basetempactionobjectList[eg][2];
-                               if (this.basetempactionobjectList[eg][4] > maxy)
-                                       maxy = 
this.basetempactionobjectList[eg][4];
-                       }
-
-                       for (var eg = 0; eg < 
this.basetempactionobjectList.length; eg++) {
-
-                               this.basetempactionobjectList[eg][1] -= minx;
-                               this.basetempactionobjectList[eg][2] -= miny;
-                               this.basetempactionobjectList[eg][3] -= minx;
-                               this.basetempactionobjectList[eg][4] -= miny
-
+                       for (var i = 0; i < points.length; ++i) {
+                               points[i].x -= minx;
+                               points[i].y -= miny;
+                               drawlineRegisterPaint(i == 0 ? points[i].x : 
points[i - 1].x
+                                       , i == 0 ? points[i].y : points[i - 1].y
+                                       , points[i].x, points[i].y);
                        }
 
                        var width = maxx - minx;
                        var height = maxy - miny;
-                       //if ($debug) Debug.info("## 1 ## NEW x,y ",minx,miny," 
width,height: ",width,height);
+                       if ($debug) Debug.info("## 1 ## NEW x,y ",minx,miny," 
width,height: ",width,height);
 
                        if (width < 2 && height < 2) {
-
                                //if ($debug) Debug.info("Add minimum size of 
Painting Line");
-
-                               if (this.basetempactionobjectList.length > 0) {
-
-                                       var lastPoint = 
this.basetempactionobjectList[this.basetempactionobjectList.length
-                                                       - 1];
-
-                                       var actionObject = new Array();
-                                       actionObject[0] = 'point';
-                                       actionObject[1] = lastPoint[3];
-                                       actionObject[2] = lastPoint[4];
-                                       actionObject[3] = lastPoint[3] + 2;
-                                       actionObject[4] = lastPoint[4] + 2;
-                                       
this.basetempactionobjectList.push(actionObject);
-
+                               if (points.length > 0) {
+                                       var lastPoint = points[points.length - 
1];
+                                       drawlineRegisterPaint(lastPoint[3].x, 
lastPoint[4].y, lastPoint[3].x + 2, lastPoint[4].y + 2);
                                } else {
-
                                        //if ($debug) Debug.info("## 2 ## 
CURRENT width,height ",this.width,this.height);
 
                                        minx = this.startx;
                                        miny = this.starty;
-
-                                       var actionObject = new Array();
-                                       actionObject[0] = 'point';
-                                       actionObject[1] = 0;
-                                       actionObject[2] = 0;
-                                       actionObject[3] = 2;
-                                       actionObject[4] = 2;
-                                       
this.basetempactionobjectList.push(actionObject);
+                                       drawlineRegisterPaint(0, 0, 2, 2);
 
                                        width = 2;
                                        height = 2;
-
                                }
-
                        }
 
                        if (this.isSnapToGrid) {
-
-                               var xgrid = Math.round((minx - 1) / 
this.gridWidth)
-                                               * this.gridWidth;
-                               var ygrid = Math.round((miny - 1) / 
this.gridWidth)
-                                               * this.gridWidth;
+                               var xgrid = Math.round((minx - 1) / 
this.gridWidth) * this.gridWidth;
+                               var ygrid = Math.round((miny - 1) / 
this.gridWidth) * this.gridWidth;
 
                                this.currentlayer = new lz.drawViewNew(this, {
                                                        name : tempName,
@@ -210,21 +166,19 @@
                        this.currentlayer.fillstyle = '0x000000';
                        this.currentlayer.lineWidth = 
this.currentlayerlineWidth;
                        this.currentlayer.strokeStyle = this.currentlayerstroke;
-
-                       for (var eg = 0; eg < 
this.basetempactionobjectList.length; eg++)
-                               
this.drawline(this.basetempactionobjectList[eg][1],
+                       //restore image after destroy
+                       for (var eg = 0; eg < 
this.basetempactionobjectList.length; ++eg) {
+                               drawline(this.basetempactionobjectList[eg][1],
                                                
this.basetempactionobjectList[eg][2],
                                                
this.basetempactionobjectList[eg][3],
                                                
this.basetempactionobjectList[eg][4]);
-
-                       //this.currentlayer.setAttribute('stretches','both');
-
-                       //Add Layer to global Layer     
+                       }
+                       //Add Layer to global Layer
                        this.layers.push(this.currentlayer);
 
                        this.registerFinal(this.getSWFDocumentStatus(), 
this.getZIndex());
                ]]>
-               </method>    
+               </method>
 
                <method name="registerFinal" args="swfObj,zIndex">
                        var actionObject = new Array();
@@ -242,17 +196,14 @@
                        actionObject[11] = currentlayer.width;//-3
                        actionObject[12] = currentlayer.height;//-2
                        actionObject[13] = this.currentlayer.name;//-1
-                       if ($debug)
-                               Debug.write("registerFinal :: ", actionObject);
+                       if ($debug) Debug.write("registerFinal :: ", 
actionObject);
                        this.baseactionobjectList.push(actionObject);
                        this.onsharedMessage('draw', actionObject);
-               </method>      
-    
-    
+               </method>
+
                <method name="paintactionHistory" 
args="lastActionObject,parentView">
                <![CDATA[
-                       if ($debug) Debug.write("## paintactionHistory", 
parentView, " opacity:",
-                                               lastActionObject[5]);
+                       if ($debug) Debug.write("## paintactionHistory", 
parentView, " opacity:", lastActionObject[5]);
 
                        var tmpCurrentlayer = new lz.drawViewNew(parentView, {
                                                name : 
lastActionObject[lastActionObject.length - 1],
@@ -284,7 +235,6 @@
                                        
lastActionObject[lastActionObject.length - 7]);
                ]]>
                </method>
-    
        </class>
 
 </library>

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDraw.lzx
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDraw.lzx?rev=1764392&r1=1764391&r2=1764392&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDraw.lzx
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDraw.lzx
 Wed Oct 12 06:56:19 2016
@@ -25,6 +25,7 @@
                <when property="$as3">
                        <passthrough>
                                import flash.printing.PrintJob;
+                               import flash.events.MouseEvent;
                        </passthrough>
                </when>
        </switch>
@@ -63,6 +64,7 @@
        <attribute name="selectedObjects" value="null"/>
 
        <attribute name="ObjectByName" value="null" />
+       <attribute name="originalFrameRate" type="number" value="0"/>
 
        <method name="getCounter">
                //Debug.write("### getCounter :",this.counter);
@@ -70,20 +72,6 @@
                return "_"+now.getTime();
        </method>
 
-       <!--
-        not needed anymore, Issue 507
-       <netRemoteCallHib name="getOID" funcname="getOID" showLoading="false"
-                                       remotecontext="$once{ canvas.thishib }" 
> 
-               <handler name="ondata" args="value">
-                       <![CDATA[
-                               //The onResult-Handler will be called be the 
rtmpconnection
-                               if($debug) Debug.write("getOID: ",value);
-                               parent.counter = value;
-                       ]]>
-               </handler>   
-       </netRemoteCallHib>      
-        -->
-
        <method name="compareAndSetCounter" args="c">
                <![CDATA[
                        if (c>this.counter) this.counter = c;
@@ -533,7 +521,7 @@
        </method>
 
        <method name="onmousedownMethod" >
-               <![CDATA[
+       <![CDATA[
                if ($debug) Debug.write("onmousedownMethod this.drawmodus: 
",this.drawmodus);
 
                if(this.selectedObjects != null && this.selectedObjects.length 
> 0){
@@ -559,7 +547,10 @@
                                this.doSetHandBodus();
                        } else if(this.drawmodus=="paint"){
                                this.startPaint();
-                               mousetracker_del.register(lz.Idle,'onidle');
+                               originalFrameRate = 
canvas.sprite.stage.frameRate;
+                               canvas.sprite.stage.frameRate = 60;
+                               if ($debug) Debug.write("Current FPS: ", 
canvas.sprite.stage.frameRate);
+                               
canvas.sprite.stage.addEventListener(MouseEvent.MOUSE_MOVE, drawLine);
                        } else if(this.drawmodus=="line"){
                                this.startLine(null);
                                this.startx = currentlayer.getMouse('x');
@@ -614,91 +605,96 @@
                                startTyping();
                        }
                }
-               ]]>
+       ]]>
+       </method>
+
+       <method name="drawLine" args="e">
+               //fake
        </method>
 
        <method name="onmouseupMethod" >
+       <![CDATA[
                if ($debug) Debug.write("onmouseupMethod this.drawmodus: 
",this.drawmodus);
-               <![CDATA[
-                       if (canvas.ismoderator || canvas.isAllowedToDraw) {
+               if (canvas.ismoderator || canvas.isAllowedToDraw) {
 
-                               var knownModus = true;
-                               if(this.drawmodus=="drag"){
-                                       this.isDragging = false;
-                                       this.dragger.remove();
-
-                                       
this.setAttribute("x",Math.round(this.x));
-                                       
this.setAttribute("y",Math.round(this.y));
-
-                                       if (this.last_x == this.x && 
this.last_x == this.x) {
-                                               if ($debug) Debug.write("No 
Change");
-                                               return;
-                                       }
+                       var knownModus = true;
+                       if(this.drawmodus=="drag"){
+                               this.isDragging = false;
+                               this.dragger.remove();
 
-                                       this.last_x = this.x;
-                                       this.last_y = this.y;
+                               this.setAttribute("x",Math.round(this.x));
+                               this.setAttribute("y",Math.round(this.y));
 
-                                       var tArray = new Array();
-                                       tArray[0] = "moveMap";
-                                       tArray[1] = this.x;
-                                       tArray[2] = this.y;
-
-                                       this.onsharedMessage('moveMap',tArray);
-
-                               } else if(this.drawmodus=="paint"){
-                                       this.endPaint();
-                                       mousetracker_del.unregisterAll();
-                               } else if(this.drawmodus=="line"){
-                                       this.endLine();
-                                       mousetracker_del.unregisterAll();
-                               } else if(this.drawmodus=="drawarrow"){
-                                       this.endDrawarrowline();
-                                       mousetracker_del.unregisterAll();
-                               } else if(this.drawmodus=="uline"){
-                                       this.endUline();
-                                       mousetracker_del.unregisterAll();
-                               } else if(this.drawmodus=="letter"){
-                                       this.endLetter();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'rectangle') {
-                                       this.endRect();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'ellipse') {
-                                       this.endEllipse();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'pointer') {
-                                       this.setAttribute('drawmodus','hand');
-                                       if (this.boundingIsActive){
-                                               
this.boundingref._innerDrag.onmouseup.sendEvent();
-                                       }
-                               } else if (this.drawmodus == 
'pointerWhiteboard') {
-                                       if ($debug) 
Debug.write("pointerWhiteboard set New Point ");
-                                       this.endPointerWhiteBoard();
-                               } else if(this.drawmodus=="clipart"){
-                                       this.endDrawClipArt();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'triangle') {
-                                       this.endTriangle();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'hand') {
-                                       this.endSelect();
-                                       mousetracker_del.unregisterAll();
-                               } else if (this.drawmodus == 'paste') {
-                               } else {
-                                       knownModus = true;
-                                       if ($debug) 
Debug.write("onmouseupMethod Unkown Modus ",this.drawmodus);
-                               }
-                               if (knownModus && !this.boundingIsActive && 
!this.letterObjectIsActive) {
-                                       endTyping();
+                               if (this.last_x == this.x && this.last_x == 
this.x) {
+                                       if ($debug) Debug.write("No Change");
+                                       return;
                                }
 
-                               this.checkStepLayers();
+                               this.last_x = this.x;
+                               this.last_y = this.y;
+
+                               var tArray = new Array();
+                               tArray[0] = "moveMap";
+                               tArray[1] = this.x;
+                               tArray[2] = this.y;
+
+                               this.onsharedMessage('moveMap',tArray);
+
+                       } else if(this.drawmodus=="paint"){
+                               canvas.sprite.stage.frameRate = 
originalFrameRate;
+                               
canvas.sprite.stage.addEventListener(MouseEvent.MOUSE_MOVE, drawLine);
+                               this.endPaint();
+                       } else if(this.drawmodus=="line"){
+                               this.endLine();
+                               mousetracker_del.unregisterAll();
+                       } else if(this.drawmodus=="drawarrow"){
+                               this.endDrawarrowline();
+                               mousetracker_del.unregisterAll();
+                       } else if(this.drawmodus=="uline"){
+                               this.endUline();
+                               mousetracker_del.unregisterAll();
+                       } else if(this.drawmodus=="letter"){
+                               this.endLetter();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'rectangle') {
+                               this.endRect();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'ellipse') {
+                               this.endEllipse();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'pointer') {
+                               this.setAttribute('drawmodus','hand');
+                               if (this.boundingIsActive){
+                                       
this.boundingref._innerDrag.onmouseup.sendEvent();
+                               }
+                       } else if (this.drawmodus == 'pointerWhiteboard') {
+                               if ($debug) Debug.write("pointerWhiteboard set 
New Point ");
+                               this.endPointerWhiteBoard();
+                       } else if(this.drawmodus=="clipart"){
+                               this.endDrawClipArt();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'triangle') {
+                               this.endTriangle();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'hand') {
+                               this.endSelect();
+                               mousetracker_del.unregisterAll();
+                       } else if (this.drawmodus == 'paste') {
                        } else {
-                               if (!this.restricted) {
-                                       this.endPointerWhiteBoard();
-                               }
+                               knownModus = true;
+                               if ($debug) Debug.write("onmouseupMethod Unkown 
Modus ",this.drawmodus);
                        }
-               ]]>
+                       if (knownModus && !this.boundingIsActive && 
!this.letterObjectIsActive) {
+                               endTyping();
+                       }
+
+                       this.checkStepLayers();
+               } else {
+                       if (!this.restricted) {
+                               this.endPointerWhiteBoard();
+                       }
+               }
+       ]]>
        </method>
 
        <method name="startTyping">
@@ -721,16 +717,11 @@
                canvas.thishib.sendMessage.doCall();
        </method>
 
-       <!--
-       <handler name="onclick" args="obj">
-               //Debug.write("click on whiteBoard ",obj);
-       </handler>
-        -->
        <method name="trackmouse" args="item">
-               <![CDATA[
-
+       <![CDATA[
                this.mx = currentlayer.getMouse('x');
                this.my = currentlayer.getMouse('y');
+               //if ($debug) Debug.info("..trackmouse ", mx, my, item);
 
                if (this.drawmodus=="paint") {
                        if (mx != prevx || my != prevy) {
@@ -826,8 +817,7 @@
                        this.endy = this.my;
                        this.drawrectangle (this.startx, this.starty, this.mx, 
this.my);
                }
-
-               ]]>
+       ]]>
        </method>
 
        <!-- ####################

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDrawImage.lzx
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDrawImage.lzx?rev=1764392&r1=1764391&r2=1764392&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDrawImage.lzx
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/baseDrawImage.lzx
 Wed Oct 12 06:56:19 2016
@@ -33,10 +33,10 @@
        <attribute name="screenImageRefNumber" value="1" type="number" />
        <attribute name="screenImageRef1" value="null" />
        <attribute name="screenImageRef2" value="null" />
-       
+
        <event name="setNewScreenUserName" />
-       
-       <!-- invoked by clicking on the confirmation dialog after 
+
+       <!-- invoked by clicking on the confirmation dialog after
                clicking on an image in the Library -->
        <method name="addNewSyncImage" 
args="urlname,posx,posy,baseurl,fileName,moduleName,parentPath,room,domain">
                if ($debug) Debug.write("urlname: ",urlname);
@@ -49,7 +49,7 @@
                        moduleName,parentPath,room,domain,
                        
this.startNewObjectSyncProcess.uniqueObjectSyncName,false);
        </method>
-       
+
        <!-- standard add Function -->
        <method name="addNewImage" 
args="urlname,posx,posy,baseurl,fileName,moduleName,parentPath,room,domain,uniqueObjectSyncName,isLocalSync">
                if ($debug) Debug.write("urlname posx: ",urlname,posx);
@@ -58,7 +58,7 @@
                        true,
                        
baseurl,fileName,moduleName,parentPath,room,domain,uniqueObjectSyncName,isLocalSync);
        </method>
-       
+
        <!--
                alterModus => this is added by the mod not remotely
         -->
@@ -77,9 +77,9 @@
                                
baseurl:baseurl,fileName:fileName,moduleName:moduleName,
                                parentPath:parentPath,room:room,domain:domain,
                                uniqueObjectSyncName:uniqueObjectSyncName,
-                               isLocalSync:isLocalSync});      
+                               isLocalSync:isLocalSync});
                        
-                       //Add Layer to global Layer     
+                       //Add Layer to global Layer
                        return this.currentlayer;
                ]]>
        </method>
@@ -95,7 +95,7 @@
                                        +'&room='+hib.currentroomid
                                        +'&domain='+hib.conferencedomain
                                        +'&sid='+canvas.sessionId;
-                       
+
                                //Debug.write("incomingScreenSharing URL: 
",downloadurl);
                                if (this.screenImageRefNumber==1){
                                        this.screenImageRef1 = new 
lz.imageForScreenViewer(this,{visible:false,src:downloadurl,refObj:this,name:'screen1',x:0,y:0,downloadurl:downloadurl});
@@ -111,8 +111,8 @@
                                (new 
lz.singletonErrorPopupHolder()).setError(canvas.getLabelName(240));
                        }
                ]]>
-       </method>   
-       
+       </method>
+
        <!--
        TODO: Make new Base Class including the Screen sharing Functions
         -->
@@ -125,15 +125,13 @@
                        if (this.screenImageRef2) 
this.screenImageRef2.destroy();
                }
                this.isScreenImageLoading = false;
-       </method> 
-       
+       </method>
+
        <!--
                actionObject => attributes neccessary for loading image
                refObj = drawarea
                isWmlLoader => (true)is loaded as part of wml-object
-               
-               -->
-               
+       -->
        <!-- method adds a new Image to the Layer,
        but without making an Update-Event, 
        Image added by remote host -->  
@@ -150,16 +148,16 @@
                                false,
                                
actionObject[2],actionObject[3],actionObject[4],actionObject[5],
                                
actionObject[6],actionObject[7],actionObject[8],false);
-                               
+
                
this.doSWFDocumentStatus(this.currentlayer,actionObject[actionObject.length-7]);
        </method>
-                       
-       <!--- 
+
+       <!---
                invoke by the initial Loading process in remoteWhiteboard.lzx, 
                does not invoke any Update Handler
                once this object is loaded, it will throw an Update event of 
kind
                addImageToLayerHistoryToLocalLoaded             
-        -->
+       -->
        <method name="addImageToLayerHistoryToLocal" args="actionObject,refObj">
                if ($debug) Debug.write("addImageToLayerHistoryToLocal: 
",actionObject,refObj);
                
this.addImageToLayer(refObj,actionObject[actionObject.length-1],actionObject[1],
@@ -169,8 +167,8 @@
                                
actionObject[2],actionObject[3],actionObject[4],actionObject[5],
                                
actionObject[6],actionObject[7],actionObject[8],true);
        </method>
-       
-       <!-- 
+
+       <!--
                this handler is implemented also in remoteWhiteboard.lzx to 
sync a Local Object list
                but throws NO Update Event, cause its only needed Locally, the 
whole Sync Process
                has a different Sync-Object for Loading the complete Object 
List from the Sever.
@@ -180,7 +178,7 @@
        <handler name="addImageToLayerHistoryToLocalLoaded" args="objRef">
                if ($debug) Debug.write("addImageToLayerHistoryToLocal: 
",objRef);
                this.syncImageRefObj = objRef;
-               
+
                this.registerNewImage(this.syncImageRefObj.src,
                        this.syncImageRefObj.x,this.syncImageRefObj.y,
                        this.syncImageRefObj.width,this.syncImageRefObj.height,
@@ -233,11 +231,11 @@
        <method name="storeTempValsAndLoadSyncList" args="objRef">
                if ($debug) Debug.write("storeTempValsAndLoadSyncList: 
",objRef);
                this.syncImageRefObj = objRef;
-               
+
                //This invokes a Method which is in the remoteWhiteboard.lzx
                this.sendCompletedObjectSyncEvent.uniqueObjectSyncName = 
this.syncImageRefObj.uniqueObjectSyncName;
                this.sendCompletedObjectSyncEvent.doCall();
-               
+
                this.registerNewImage(this.syncImageRefObj.src,
                        this.syncImageRefObj.x,this.syncImageRefObj.y,
                        this.syncImageRefObj.width,this.syncImageRefObj.height,
@@ -245,10 +243,9 @@
                        
this.syncImageRefObj.moduleName,this.syncImageRefObj.parentPath,
                        this.syncImageRefObj.room,this.syncImageRefObj.domain,
                        
true,this.syncImageRefObj.uniqueObjectSyncName,this.getSWFDocumentStatus(),
-                               this.getZIndex());              
-       
+                       this.getZIndex());
        </method>
-       
+
        <!--- @keywords deprecated
        TODO: check Recorder Modus
         -->
@@ -258,7 +255,7 @@
                this.doRegisterAfterLoadingOrRecording();
                this.sendCompleteImageSync();
        </method>
-       
+
        <method name="sendLoadNotificationImage" args="objRef" >
                if ($debug) Debug.write("sendLoadNotificationImage: ",objRef);
                this.syncImageRefObj = objRef;
@@ -269,12 +266,12 @@
                        
this.syncImageRefObj.moduleName,this.syncImageRefObj.parentPath,
                        this.syncImageRefObj.room,this.syncImageRefObj.domain,
                        
false,this.syncImageRefObj.uniqueObjectSyncName,this.getSWFDocumentStatus(),
-                               this.getZIndex());      
+                       this.getZIndex());
                //This invokes a Method which is in the remoteWhiteboard.lzx
                this.sendCompletedObjectSyncEvent.uniqueObjectSyncName = 
this.syncImageRefObj.uniqueObjectSyncName;
                this.sendCompletedObjectSyncEvent.doCall();
        </method>
-       
+
        <!--- @keywords deprecated
        TODO: Check recorder Modus
         -->
@@ -284,15 +281,13 @@
                //now send notifications to connected clients
                this.setAttribute('drawmodus','image');
                this.registerNewImage(this.syncImageRefObj.src,
-                                         
this.syncImageRefObj.x,this.syncImageRefObj.y,
-                                         
this.syncImageRefObj.width,this.syncImageRefObj.height,
-                                         
this.syncImageRefObj.baseurl,this.syncImageRefObj.fileName,
-                                         
this.syncImageRefObj.moduleName,this.syncImageRefObj.parentPath,
-                                         
this.syncImageRefObj.room,this.syncImageRefObj.domain,
-                                         
false,this.syncImageRefObj.uniqueObjectSyncName,this.getSWFDocumentStatus(),
-                                         this.getZIndex());            
+                               this.syncImageRefObj.x,this.syncImageRefObj.y,
+                               
this.syncImageRefObj.width,this.syncImageRefObj.height,
+                               
this.syncImageRefObj.baseurl,this.syncImageRefObj.fileName,
+                               
this.syncImageRefObj.moduleName,this.syncImageRefObj.parentPath,
+                               
this.syncImageRefObj.room,this.syncImageRefObj.domain,
+                               
false,this.syncImageRefObj.uniqueObjectSyncName,this.getSWFDocumentStatus(),
+                               this.getZIndex());
        </method>
-       
 </class>
-
 </library>

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/tools/baseDrawPaint.lzx
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/tools/baseDrawPaint.lzx?rev=1764392&r1=1764391&r2=1764392&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/tools/baseDrawPaint.lzx
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/whiteboard/base/tools/baseDrawPaint.lzx
 Wed Oct 12 06:56:19 2016
@@ -19,30 +19,39 @@
   
 -->
 <library>
-
        <class name="baseDrawPaint" extends="baseDraw" >
-    
+               <switch>
+                       <when property="$as3">
+                               <passthrough>
+                                       import flash.geom.Point;
+                               </passthrough>
+                       </when>
+               </switch>
                <!-- paint -->
                <attribute name="currentlayerstroke" value="0xFF6600" />
                <attribute name="currentlayerlineWidth" value="2" type="number" 
/>
                <attribute name="currentlayerOpacity" value="1" type="number" />
-    
-               <!-- TODO: Check if needed, seems to have no reference -->
-               <attribute name="painttrans" value="false" type="boolean" />
-          
-               <!-- #####################
-                               Paint
-                        -->
-    
+               <attribute name="minx" value="0" type="number" />
+               <attribute name="miny" value="0" type="number" />
+               <attribute name="maxx" value="0" type="number" />
+               <attribute name="maxy" value="0" type="number" />
+               <attribute name="g" type="object"/>
+               <attribute name="points" type="object"/>
+
                <method name="drawline" args="x1,y1,x2,y2">
-               <![CDATA[
-                       currentlayer.beginPath();
-                       currentlayer.moveTo(x1, y1);
-                       currentlayer.lineTo(x2, y2);
-                       currentlayer.stroke();
-               ]]>
+                       drawlineOnObject(currentlayer, x1, y1, x2, y2);
+               </method>
+
+               <method name="drawLine" args="e">
+                       var p = new Point(currentlayer.getMouse('x'), 
currentlayer.getMouse('y'));
+                       g.lineTo(p.x, p.y);
+                       points.push(p);
+                       minx = Math.min(p.x, minx);
+                       maxx = Math.max(p.x, maxx);
+                       miny = Math.min(p.y, miny);
+                       maxy = Math.max(p.y, maxy);
                </method>
-    
+
                <method name="drawlineOnObject" args="obj,x1,y1,x2,y2">
                <![CDATA[
                        obj.beginPath();
@@ -51,20 +60,13 @@
                        obj.stroke();
                ]]>
                </method>
-        
-    
+
                <method name="drawlineRegisterPaint" args="x1,y1,x2,y2">
-                       var actionObject = new Array();
-                       actionObject[0] = 'point';
-                       actionObject[1] = x1;
-                       actionObject[2] = y1;
-                       actionObject[3] = x2;
-                       actionObject[4] = y2;
-                       this.basetempactionobjectList.push(actionObject);
-               </method> 
-         
-               <method name="startPaint">
+                       this.basetempactionobjectList.push(['point', x1, y1, 
x2, y2]);
+               </method>
 
+               <method name="startPaint">
+               <![CDATA[
                        //Debug.write("startPaint ",this.startx,this.starty);
                        this.currentlayer = new lz.drawViewNew(this, {
                                                name : 'paint' + 
this.getCounter(),
@@ -89,104 +91,58 @@
                        currentlayer.lineWidth = this.currentlayerlineWidth;
                        currentlayer.fillstyle = '0x000000';
 
-                       this.basetempactionobjectList = new Array();
-
-                       //beginFill( the_colorpicker.selectedColor );
+                       minx = this.width + 2;
+                       miny = this.height + 2;
+                       maxx = -2;
+                       maxy = -2;
+                       points = new Array();
+                       g = currentlayer.__drawcontext.graphics;
+                       g.lineStyle(currentlayer.lineWidth, 
currentlayer.strokeStyle);
+                       var p = new Point(currentlayer.getMouse('x'), 
currentlayer.getMouse('y'));
+                       points.push(p)
+                       g.moveTo(p.x, p.y);
+               ]]>
                </method>
 
                <method name="endPaint">
-        ////Debug.write("endPaint");
                <![CDATA[
+                       if ($debug) Debug.write("endPaint:: ", minx, miny, 
points);
                        var tempName = this.currentlayer.name;
                        this.currentlayer.destroy();
+                       this.basetempactionobjectList = new Array();
 
-                       //GetBounds of that Object
-                       var minx = this.width + 2;
-                       var miny = this.height + 2;
-                       var maxx = -2;
-                       var maxy = -2;
-
-                       for (var eg = 0; eg < 
this.basetempactionobjectList.length; eg++) {
-                               
////Debug.write(this.basetempactionobjectList[eg][1],this.basetempactionobjectList[eg][3]);
-                               if (this.basetempactionobjectList[eg][1] < minx)
-                                       minx = 
this.basetempactionobjectList[eg][1];
-                               if (this.basetempactionobjectList[eg][3] < minx)
-                                       minx = 
this.basetempactionobjectList[eg][3];
-
-                               if (this.basetempactionobjectList[eg][1] > maxx)
-                                       maxx = 
this.basetempactionobjectList[eg][1];
-                               if (this.basetempactionobjectList[eg][3] > maxx)
-                                       maxx = 
this.basetempactionobjectList[eg][3];
-
-                               if (this.basetempactionobjectList[eg][2] < miny)
-                                       miny = 
this.basetempactionobjectList[eg][2];
-                               if (this.basetempactionobjectList[eg][4] < miny)
-                                       miny = 
this.basetempactionobjectList[eg][4];
-
-                               if (this.basetempactionobjectList[eg][2] > maxy)
-                                       maxy = 
this.basetempactionobjectList[eg][2];
-                               if (this.basetempactionobjectList[eg][4] > maxy)
-                                       maxy = 
this.basetempactionobjectList[eg][4];
-                       }
-
-                       for (var eg = 0; eg < 
this.basetempactionobjectList.length; eg++) {
-
-                               this.basetempactionobjectList[eg][1] -= minx;
-                               this.basetempactionobjectList[eg][2] -= miny;
-                               this.basetempactionobjectList[eg][3] -= minx;
-                               this.basetempactionobjectList[eg][4] -= miny
-
+                       for (var i = 0; i < points.length; ++i) {
+                               points[i].x -= minx;
+                               points[i].y -= miny;
+                               drawlineRegisterPaint(i == 0 ? points[i].x : 
points[i - 1].x
+                                       , i == 0 ? points[i].y : points[i - 1].y
+                                       , points[i].x, points[i].y);
                        }
 
                        var width = maxx - minx;
                        var height = maxy - miny;
-                       //if ($debug) Debug.info("## 1 ## NEW x,y ",minx,miny," 
width,height: ",width,height);
+                       if ($debug) Debug.info("## 1 ## NEW x,y ",minx,miny," 
width,height: ",width,height);
 
                        if (width < 2 && height < 2) {
-
                                //if ($debug) Debug.info("Add minimum size of 
Painting Line");
-
-                               if (this.basetempactionobjectList.length > 0) {
-
-                                       var lastPoint = 
this.basetempactionobjectList[this.basetempactionobjectList.length
-                                                       - 1];
-
-                                       var actionObject = new Array();
-                                       actionObject[0] = 'point';
-                                       actionObject[1] = lastPoint[3];
-                                       actionObject[2] = lastPoint[4];
-                                       actionObject[3] = lastPoint[3] + 2;
-                                       actionObject[4] = lastPoint[4] + 2;
-                                       
this.basetempactionobjectList.push(actionObject);
-
+                               if (points.length > 0) {
+                                       var lastPoint = points[points.length - 
1];
+                                       drawlineRegisterPaint(lastPoint[3].x, 
lastPoint[4].y, lastPoint[3].x + 2, lastPoint[4].y + 2);
                                } else {
-
                                        //if ($debug) Debug.info("## 2 ## 
CURRENT width,height ",this.width,this.height);
 
                                        minx = this.startx;
                                        miny = this.starty;
-
-                                       var actionObject = new Array();
-                                       actionObject[0] = 'point';
-                                       actionObject[1] = 0;
-                                       actionObject[2] = 0;
-                                       actionObject[3] = 2;
-                                       actionObject[4] = 2;
-                                       
this.basetempactionobjectList.push(actionObject);
+                                       drawlineRegisterPaint(0, 0, 2, 2);
 
                                        width = 2;
                                        height = 2;
-
                                }
-
                        }
 
                        if (this.isSnapToGrid) {
-
-                               var xgrid = Math.round((minx - 1) / 
this.gridWidth)
-                                               * this.gridWidth;
-                               var ygrid = Math.round((miny - 1) / 
this.gridWidth)
-                                               * this.gridWidth;
+                               var xgrid = Math.round((minx - 1) / 
this.gridWidth) * this.gridWidth;
+                               var ygrid = Math.round((miny - 1) / 
this.gridWidth) * this.gridWidth;
 
                                this.currentlayer = new lz.drawViewNew(this, {
                                                        name : tempName,
@@ -210,21 +166,19 @@
                        this.currentlayer.fillstyle = '0x000000';
                        this.currentlayer.lineWidth = 
this.currentlayerlineWidth;
                        this.currentlayer.strokeStyle = this.currentlayerstroke;
-
-                       for (var eg = 0; eg < 
this.basetempactionobjectList.length; eg++)
-                               
this.drawline(this.basetempactionobjectList[eg][1],
+                       //restore image after destroy
+                       for (var eg = 0; eg < 
this.basetempactionobjectList.length; ++eg) {
+                               drawline(this.basetempactionobjectList[eg][1],
                                                
this.basetempactionobjectList[eg][2],
                                                
this.basetempactionobjectList[eg][3],
                                                
this.basetempactionobjectList[eg][4]);
-
-                       //this.currentlayer.setAttribute('stretches','both');
-
-                       //Add Layer to global Layer     
+                       }
+                       //Add Layer to global Layer
                        this.layers.push(this.currentlayer);
 
                        this.registerFinal(this.getSWFDocumentStatus(), 
this.getZIndex());
                ]]>
-               </method>    
+               </method>
 
                <method name="registerFinal" args="swfObj,zIndex">
                        var actionObject = new Array();
@@ -242,17 +196,14 @@
                        actionObject[11] = currentlayer.width;//-3
                        actionObject[12] = currentlayer.height;//-2
                        actionObject[13] = this.currentlayer.name;//-1
-                       if ($debug)
-                               Debug.write("registerFinal :: ", actionObject);
+                       if ($debug) Debug.write("registerFinal :: ", 
actionObject);
                        this.baseactionobjectList.push(actionObject);
                        this.onsharedMessage('draw', actionObject);
-               </method>      
-    
-    
+               </method>
+
                <method name="paintactionHistory" 
args="lastActionObject,parentView">
                <![CDATA[
-                       if ($debug) Debug.write("## paintactionHistory", 
parentView, " opacity:",
-                                               lastActionObject[5]);
+                       if ($debug) Debug.write("## paintactionHistory", 
parentView, " opacity:", lastActionObject[5]);
 
                        var tmpCurrentlayer = new lz.drawViewNew(parentView, {
                                                name : 
lastActionObject[lastActionObject.length - 1],
@@ -284,7 +235,6 @@
                                        
lastActionObject[lastActionObject.length - 7]);
                ]]>
                </method>
-    
        </class>
 
 </library>



Reply via email to