wiki:FRAME_ROTATION_R2
Last modified 16 years ago Last modified on 09/23/09 20:54:36

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=FRAME_ROTATION_R2, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

Note: This analysis uses big part of the FRAME_ROTATION_R1.
Update the frame rotation user interface to support dragging of a halo to rotate the frame. Rotation of groups need additional discussions and will be considered in the next revision.

Task requirements

  • Reduce the rotation halo menu to one button
  • Change the icon of the halo rotation button to indicate it can be dragged
  • The halo button won't be rotated.
  • Make sure the halo button moves with the frame. Currently halos lay out around the unrotated bounding box enclosing the rotated frame.
  • (optional) Remove the two halos for rotating, that are used now to rotate the frame clockwise and counterclockwise with 30 degrees.

Task result

The result of this task is code.

Implementation idea

  • In order not to overlap the rotation halo and the frame title bar, we can assume that the rotation halo top left corner is the same as the frame bottom right corner.
  • Rotate around the rotation center of the frame. The contents of the HUD that is used now for changing the rotation center and precise rotation will be moved to appearance HUD (GROUP_HUDS_R0)
  • Rotation center, the top left corner of the halo and mouse should be on the same line, when the user drags the halo button.
    • in the diagram below the dark rectangle represents single frame, the gray one is the halo button. And the rotation point is the one that the frame is rotates around. The rotation point will stay consistent no meter the rotation of the frame.

How to demo

  • Run the application
  • Create a new book
  • Insert frame and rotate it
  • Insert few more frames and try to rotate each one individually

Design

  • Reduce the rotation halo menu to one button
    • Remove FrameRotateLeftHaloButton, FrameRotationPropertiesHaloButton and FrameRotateRightHaloButton as children of FrameRotateHaloMenu.
    • Delete these classes, as well as FrameRotateLogic
  • Position of the halo button: it should follow the bottom right corner of the margin rectangle. The center of the halo will stay on the same position as if the halo was rotated like the frame and its top left corner coincided with the bottom right corner of the margin. However the halo will not be rotated.
    • A new property - public Prop<ImmPoint> controlPoint() will be added to FrameRotateHaloMenu. It will hold the top left corner of the halo in scene coordinates and will be used both for positioning the menu and for rotation logic.
      • Since the menu cannot depend on the halo, we will use the menu's size in all calculations. This means that if we add another button to the rotation menu, its position will change :-(
    • The computeLocation() method in FrameRotateHaloMenu will be changed to get the control point and transform its coordinates from scene to swing.
    • In order to prevent the main halo menu from overlapping with other menus (rotation and text), it will be moved upwards by 30px
      • this will be done by overriding computeLocation() in MainHaloMenu - in order avoid moving the page menu, the location will be translated by (0, -30) only if the title bar is visible.
  • Rotation logic:
    • A new class FrameRotateHaloButton extending MoveHaloButton will be created.
    • Since it is part of a floating menu, its alignment will be Alignment.START
    • The protected MouseCapture captureClick(MouseEvent e) method contains the main logic:
      • all calculations will be in the frame parent's space.
      • compute the new control points coordinates
      • new angle = old angle + the angle between (rotation center, old control point) and (rotation center, new control point)
      • new location = old location, rotated by the new angle around the rotation center
      • the view rectangle should be locked before creating a MouseCapture and unlocked on releasing the mouse.
    • A method computing the angle between a given vector and the x-axis will be added in ImmSize.

Implementation

Done according to the design...
Since the FrameSizeAndAppearanceHud will not be ready for the release, I added the FramePropertiesHaloButton in the main menu.
[6566], [6587], [6645] and [6681]

Merged into trunk in [6705].

Testing

(Place the testing results here.)

Comments

(Write comments for this or later revisions here.)

Attachments