#include <textops.h>
Inheritance diagram for OpDragStoryNonPathIndent:
Public Member Functions | |
OpDragStoryNonPathIndent () | |
~OpDragStoryNonPathIndent () | |
Protected Member Functions | |
virtual DocCoord | InternalConstrain (DocCoord Current, ClickModifiers ClickMods) |
Constrains the drag of indents not on a path. | |
virtual BOOL | SetCurrentPos (DocCoord MousePos, ClickModifiers ClickMods) |
Given a position sets mCurrentBlobPos to it. | |
Private Member Functions | |
CC_DECLARE_DYNAMIC (OpDragStoryNonPathIndent) |
Definition at line 916 of file textops.h.
|
Definition at line 922 of file textops.h.
|
|
Definition at line 923 of file textops.h.
|
|
|
|
Constrains the drag of indents not on a path.
Implements OpDragStoryIndent. Definition at line 5766 of file textops.cpp. 05767 { 05768 // By default drag along the baseline 05769 if (!ClickMods.Adjust && !ClickMods.Constrain) 05770 { 05771 const double OrigLength = GetThisIndent().Distance(GetOtherIndent()); 05772 double Hypot = GetOtherIndent().Distance(Current); 05773 double Oppo = DocCoord::DistanceFromLine(GetThisIndent(), GetOtherIndent(), Current); 05774 double Adj = sqrt(Hypot*Hypot - Oppo*Oppo); 05775 double Ratio = 1.0; 05776 if (OrigLength != 0.0) 05777 Ratio = Adj/(OrigLength); 05778 05779 const DocCoord JoinPoint = GetOtherIndent(); 05780 const DocCoord OtherJoinEnd = GetThisIndent(); 05781 const DocCoord cCurrent = Current; 05782 05783 if (DocCoord::IsJoinAcute(&JoinPoint, &OtherJoinEnd, &cCurrent)) 05784 return DocCoord::PositionPointFromRatio(JoinPoint, OtherJoinEnd, Ratio); 05785 else 05786 return DocCoord::PositionPointFromRatio(JoinPoint, OtherJoinEnd, -Ratio); 05787 } 05788 else 05789 { 05790 // CTRL is angle constrain, // SHIFT is unconstrained 05791 if (ClickMods.Constrain) 05792 { 05793 DocCoord Anchor = GetOtherIndent(); 05794 DocView::ConstrainToAngle(Anchor, &Current); 05795 } 05796 05797 DocView::SnapCurrent(mpStartSpread, &Current); 05798 } 05799 05800 return Current; 05801 }
|
|
Given a position sets mCurrentBlobPos to it.
Implements OpDragStoryIndent. Definition at line 5838 of file textops.cpp. 05839 { 05840 ERROR3IF(mpStoryPath!=NULL, "Story is on a path, you don't want to use this function"); 05841 05842 mCurrentBlobPos = InternalConstrain(MousePos, ClickMods); 05843 05844 return TRUE; 05845 }
|