Question
Direction lines disappear during mouse drag
In a plug-in tool for CS3 that I'm writing the in- or out handle of a path's direction line can be selected and dragged around. The path shape is correctly updated while dragging. However, the direction lines are hidden while dragging and are only displayed again when the mouse button is released. Does anybody know how to prevent the direction lines from disappearing while dragging with the mouse?
My code is based on the MultiArrowTool sample that comes with the SDK and the two relevant sections are listed below. Here, hitRef is a global variable.
extern AIErr toolMouseDown( AIToolMessage *message ) {
AIErr error = kNoErr;
error = sAIHitTest->HitTest( NULL, &message->cursor, kAllHitRequest, &hitRef);
if ( error )
goto error;
error:
return error;
}
extern AIErr toolMouseDrag( AIToolMessage *message )
{
AIErr error = kNoErr;
AIToolHitData hitData;
AIPathSegment hitSegment;
AIArtHandle hitArt;
error = sAIUndo->UndoChanges( );
if (sAIHitTest->IsHit(hitRef))
{
sAIHitTest->GetHitData(hitRef, &hitData);
if (hitData.type == kInHitType)
{
hitArt = sAIHitTest->GetArt(hitRef);
sAIPath->GetPathSegments(hitArt, hitData.segment, 1, &hitSegment);
hitSegment.out = message->cursor;
sAIPath->SetPathSegments( hitArt, hitData.segment, 1, &hitSegment );
}
else if (hitData.type == kOutHitType)
{
hitArt = sAIHitTest->GetArt(hitRef);
sAIPath->GetPathSegments(hitArt, hitData.segment, 1, &hitSegment );
hitSegment.in = message->cursor;
sAIPath->SetPathSegments( hitArt, hitData.segment, 1, &hitSegment );
}
};
return error;
}
Anybody who can help me?
Regards,
Peter
My code is based on the MultiArrowTool sample that comes with the SDK and the two relevant sections are listed below. Here, hitRef is a global variable.
extern AIErr toolMouseDown( AIToolMessage *message ) {
AIErr error = kNoErr;
error = sAIHitTest->HitTest( NULL, &message->cursor, kAllHitRequest, &hitRef);
if ( error )
goto error;
error:
return error;
}
extern AIErr toolMouseDrag( AIToolMessage *message )
{
AIErr error = kNoErr;
AIToolHitData hitData;
AIPathSegment hitSegment;
AIArtHandle hitArt;
error = sAIUndo->UndoChanges( );
if (sAIHitTest->IsHit(hitRef))
{
sAIHitTest->GetHitData(hitRef, &hitData);
if (hitData.type == kInHitType)
{
hitArt = sAIHitTest->GetArt(hitRef);
sAIPath->GetPathSegments(hitArt, hitData.segment, 1, &hitSegment);
hitSegment.out = message->cursor;
sAIPath->SetPathSegments( hitArt, hitData.segment, 1, &hitSegment );
}
else if (hitData.type == kOutHitType)
{
hitArt = sAIHitTest->GetArt(hitRef);
sAIPath->GetPathSegments(hitArt, hitData.segment, 1, &hitSegment );
hitSegment.in = message->cursor;
sAIPath->SetPathSegments( hitArt, hitData.segment, 1, &hitSegment );
}
};
return error;
}
Anybody who can help me?
Regards,
Peter