Changes between Version 21 and Version 22 of FRAME_ROTATION_R1


Ignore:
Timestamp:
06/23/09 11:09:39 (16 years ago)
Author:
sriggins
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FRAME_ROTATION_R1

    v21 v22  
    5252 * Create a new book 
    5353 * Insert frame and rotate it 
    54  * Insert few more frames and try to rotate them 
     54 * Insert few more frames and try to rotate each one individually 
    5555 
    5656= Design = 
    5757 
    58  * Define class FrameRotateButton: 
     58The design for this task is broken into the following categories: 
    5959 
    60 {{{ 
    61 public class FrameRotateHaloButton extends MoveHaloButton { 
    62         private static void defineSkin(ElementSkinPart part); 
    63         public Prop<FrameRotateHaloMenu> parent(); 
    64         protected MouseCapture captureClick(MouseEvent e); 
    65         protected boolean computeVisible(); 
    66         public Prop<PageWorkArea> workArea(); 
    67 } 
    68 }}} 
     60  * Removing the rotate right and rotate left buttons from  FrameRotateHaloMenu 
     61  * Fixing the rotation properties dialog to rotate properly 
     62  * Positioning the rotation halo menu properly 
     63  * Writing a new class to handle both showing the rotation properties hud, and have it be draggable to rotate the frame 
    6964 
    70  * Update FrameRotateHaloMenu 
     65The following classes were modified: 
    7166 
    72     FrameRotateHaloMenu currently defines it's location as the topRIght of the selection bounds, but that is no longer valid.  Determine new location based on bottomRight, extended down the vector from the top left by a distance of 15 (constant defined in class HALO_OUTSET) and then rotating the center point of the hud around the content location point. 
     67  * FrameRotateHaloMenu 
     68  * FrameRotationPropertiesHud 
     69  * FrameRotateRightHaloButton (Removed from the menu, but fixed to ensure it would work should it be used at a later point in time) 
     70  * FrameRotateLeftHaloButton (Removed from the menu, but fixed to ensure it would work should it be used at a later point in time) 
     71  * FrameRotateLogic 
     72  * AppHaloUtil 
     73  * HaloMenu 
     74  * HudHaloButton 
     75  * MouseCapture 
     76  
     77The follow classes were added: 
    7378 
    74  * Halo visibility 
     79  * HudHalo - An interface implemented by HudHaloButton and FrameDragRotatePropertiesHaloButton (more on this later) 
     80  * FrameDragRotatePropertiesHaloButton 
    7581 
    76    Define halo visibility based on the number of selected frames.  For phase 1, only show the halo if one frame is selected.  For the optional task of rotating grouped frames, show the halo if > 0 frames are selected 
     82== FrameRotationPropertiesHud == 
    7783 
    78  * ImmPoint 
     84  This class is responsible for defining the rotation center and rotation angle.  It was determined during design that this hud had been eliminated in the analysis of this task and needed to be added back.  This class was not updated during the rotation improvements of FRAME_SIZE_R1 and thus needed fixing.  The FRAME_SIZE_R1 fixes added a EventR3 for ROTATE, but this event handled rotation by an incremental amount, whereas the rotation properties hud supplies an absolute rotation amount. 
    7985 
    80   Add helper method rotateAround(radians, point) which returns a new point rotated around the give point by the given radians.  Example use:  rotate size of a frame content by frame content's radians around the frame content location.   
     86  So, the ROTATE enum was renamed to ROTATE_BY and a new enum, ROTATE_TO was added to FrameRotateLogic. 
    8187 
    82  * Frame 
     88  This class was changed to use the new EventR3, ROTATE_TO. 
    8389 
    84  Change the default rotation center position to TOP_LEFT.  This will be factored out later so all calculations are done on contentLocation without the need to go through the rotationCenter logic 
     90  This class also had its parent changed to FrameDragRotatePropertiesHaloButton 
    8591 
    86  * ImmMatrix 
     92== FrameRotateRightHaloButton / FrameRotateRightHaloButton == 
    8793 
    88 === UML === 
     94  These classes were removed from FrameRotateHaloMenu, but they were updated to use the new ROTATE_BY EventR3, just in case this code is ressurected for use later 
    8995 
    90 [[Image(FRAME_ROTATION_R1_UML.png)]] 
     96== FrameRotateLogic == 
     97 
     98  This class now implements ROTATE_TO.  This method has to back out the existing rotation before it can apply the new rotation, or the frame will "walk" across the page, because all frame rotation is based around the content location now. 
     99 
     100== AppHaloUtil == 
     101 
     102  A helper method, getFirstFrameView, was added to get the first frame in the selection 
     103 
     104= FrameRotateHaloMenu = 
     105 
     106  The computeLocation method was changed to a fairly complex bit of code.  First, we have to calculate a line from the top left of the frame to the bottom right.  We then extend this line by HALO_OFFSET, a static final value, to determine where the halo menu should be centered.  We then calculate the new endpoint of the line and have a haloMenuCenter. 
     107 
     108  This new center is in unrotated frame coodinates though, so we create a matrix rotated around the frame's content location to find the frameRotationCenter. 
     109 
     110  Next we create a matrix to rotate a point around the frameRotationCenter by the frame's current rotation value, and transform our haloMenuCenter. 
     111 
     112  Next, we use scene helpers to get the scene's effective transform and transform our haloMenuCenter by that.  This is done so we zoom properly. 
     113 
     114  Next, we offset the haloMenuCenter so the halo menu will be centered on the proper point. 
     115 
     116  Finally, we convert the coordinates from scene to swing coordinates.  The halo menu is now properly positioned for a rotated and scaled frame. 
     117 
     118== FrameDragRotatePropertiesHaloButton == 
     119 
     120  FrameDragRotatePropertiesHaloButton is the class that handles showing the properties hud and rotating the frame when drug around the rotation center.  It was discovered that the existing classes, MoveHaloButton and HaloHudButton were not designed to be used together.  After some discussion, it was decided, in order to finish the task on time, to create FrameDragRotatePropertiesHaloButton and have it subclass from MoveHaloButton. 
     121 
     122  Then, the two methods from HaloHudButton, hud() and computeHud() would be copied into this class, to save time until we refactor the other halo buttons.  This allows FrameDragRotatePropertiesHaloButton to both show the properties hud when single clicked, and to rotate the frame when drug. 
     123 
     124  However, the properties hud would not show, because HaloMenu checks for (b instanceOf HudHaloButton) in two places.  Not wanting to break anything, but also finish the task, a new interface was implemented, HudHalo, with the single method hud(). 
     125 
     126  Both HudHaloButton and FrameDragRotatePropertiesHaloButton implement HudHalo, and HaloMenu now checks (b instanceof HudHalo) for its sanity checks.  This factors out the implemention from the intention of the class check. 
     127 
     128  FrameDragRotatePropertiesHaloButton uses the same pattern as FrameMoveHaloButton.  It calculates out the angle between the rotationCenter, the click point and the current mouse point.  It then uses this to create a theta delta which is then applied to the frame via the ROTATE_BY EventR3. 
     129 
     130 
     131== MouseCapture == 
     132 
     133  MouseCapture was updated slightly to record the original click location and the current click location.  A new method, hasMoved(), was added that returns TRUE if the mouse has moved at all during the life of this MouseCapture instance, and false if it has not. 
    91134 
    92135=== UnitTest === 
    93136 
    94  ImmPointTest -  
     137 I have not decided what a good unit test for these classes are yet 
    95138 
    96139 
    97140= Implementation = 
    98 ^(Describe and link the implementation results here (from the wiki or the repository).)^ 
     141 
     142 Implemented as designed 
    99143 
    100144= Testing = 
     
    110154 
    111155Put the discreet rotation buttons into the hud.  Change the halo menu button to show the halo hud if single clicked. -sriggins 
     156 
     157== Huds not part of the page work area == 
     158 
     159Now because the properties hud moves around the frame, it is possible to have the hud completely off screen and usable.  We should consider making huds affect the page work area size -- sriggins