DiskUsage: Open file/folder on cmd-click, zoom on regular click.

This commit is contained in:
John Scipione 2014-06-05 17:55:42 -04:00
parent eef00544a4
commit 5443e035e8

View File

@ -243,21 +243,32 @@ PieView::MouseDown(BPoint where)
void void
PieView::MouseUp(BPoint where) PieView::MouseUp(BPoint where)
{ {
// If the primary button was released and there was no dragging happening,
// just zoom in or out.
if (fClicked && !fDragging) { if (fClicked && !fDragging) {
// The primary mouse button was released and there's no dragging happening.
FileInfo* info = _FileAt(where); FileInfo* info = _FileAt(where);
if (info != NULL) { if (info != NULL) {
if (info == fScanner->CurrentDir()) { BMessage* current = Window()->CurrentMessage();
fScanner->ChangeDir(info->parent);
fLastWhere = where; uint32 modifiers;
fUpdateFileAt = true; if (current->FindInt32("modifiers", (int32*)&modifiers) != B_OK)
Invalidate(); modifiers = 0;
} else if (info->children.size() > 0) {
fScanner->ChangeDir(info); if ((modifiers & B_COMMAND_KEY) != 0) {
fLastWhere = where; // launch the app on command-click
fUpdateFileAt = true; _Launch(info);
Invalidate(); } else {
// zoom in or out
if (info == fScanner->CurrentDir()) {
fScanner->ChangeDir(info->parent);
fLastWhere = where;
fUpdateFileAt = true;
Invalidate();
} else if (info->children.size() > 0) {
fScanner->ChangeDir(info);
fLastWhere = where;
fUpdateFileAt = true;
Invalidate();
}
} }
} }
} }