ui: only single class expand button next to class name
This change reduces the size of collapsed classes in the GraphView by removing the condensed view of the class access nodes and using a single button next to the class name for collapsing and expanding instead.
This commit is contained in:
@@ -102,7 +102,7 @@ size_t GraphViewStyle::getFontSizeOfAccessNode()
|
||||
return 11;
|
||||
}
|
||||
|
||||
size_t GraphViewStyle::getFontSizeOfNumber()
|
||||
size_t GraphViewStyle::getFontSizeOfExpandToggleNode()
|
||||
{
|
||||
return 9;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ std::string GraphViewStyle::getFontNameOfAccessNode()
|
||||
return "Myriad Pro";
|
||||
}
|
||||
|
||||
std::string GraphViewStyle::getFontNameOfNumber()
|
||||
std::string GraphViewStyle::getFontNameOfExpandToggleNode()
|
||||
{
|
||||
return "Myriad Pro";
|
||||
}
|
||||
@@ -125,7 +125,8 @@ std::string GraphViewStyle::getFontNameOfNumber()
|
||||
GraphViewStyle::NodeMargins GraphViewStyle::getMarginsForNodeType(Node::NodeType type, bool hasChildren)
|
||||
{
|
||||
NodeMargins margins;
|
||||
margins.spacingX = margins.spacingY = 8;
|
||||
margins.spacingX = 12;
|
||||
margins.spacingY = 8;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -145,14 +146,14 @@ GraphViewStyle::NodeMargins GraphViewStyle::getMarginsForNodeType(Node::NodeType
|
||||
case Node::NODE_FILE:
|
||||
if (hasChildren)
|
||||
{
|
||||
margins.left = margins.right = 15;
|
||||
margins.top = 30;
|
||||
margins.left = margins.right = 10;
|
||||
margins.top = 33;
|
||||
margins.bottom = 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
margins.left = margins.right = 8;
|
||||
margins.top = margins.bottom = 13;
|
||||
margins.top = margins.bottom = 17;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -177,37 +178,26 @@ GraphViewStyle::NodeMargins GraphViewStyle::getMarginsForNodeType(Node::NodeType
|
||||
return margins;
|
||||
}
|
||||
|
||||
GraphViewStyle::NodeMargins GraphViewStyle::getMarginsOfAccessNode(
|
||||
bool expanded, size_t subNodeCount, size_t invisibleSubNodeCount
|
||||
){
|
||||
GraphViewStyle::NodeMargins GraphViewStyle::getMarginsOfAccessNode()
|
||||
{
|
||||
NodeMargins margins;
|
||||
margins.spacingX = margins.spacingY = 8;
|
||||
|
||||
margins.left = margins.right = 10;
|
||||
margins.top = 40;
|
||||
margins.bottom = 10;
|
||||
|
||||
if (invisibleSubNodeCount == subNodeCount)
|
||||
{
|
||||
margins.minWidth = 20;
|
||||
margins.bottom = 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
margins.minWidth = 82;
|
||||
margins.minWidth = 82;
|
||||
|
||||
if (expanded)
|
||||
{
|
||||
margins.bottom = 15;
|
||||
}
|
||||
else if (invisibleSubNodeCount)
|
||||
{
|
||||
margins.bottom = 23;
|
||||
}
|
||||
else
|
||||
{
|
||||
margins.bottom = 10;
|
||||
}
|
||||
}
|
||||
return margins;
|
||||
}
|
||||
|
||||
GraphViewStyle::NodeMargins GraphViewStyle::getMarginsOfExpandToggleNode()
|
||||
{
|
||||
NodeMargins margins;
|
||||
|
||||
margins.left = margins.right = margins.top = margins.bottom = 11;
|
||||
margins.minWidth = 0;
|
||||
|
||||
return margins;
|
||||
}
|
||||
@@ -279,14 +269,14 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleForNodeType(
|
||||
if (hasChildren)
|
||||
{
|
||||
style.cornerRadius = 20;
|
||||
style.textOffset.x = 15;
|
||||
style.textOffset.x = 10;
|
||||
style.textOffset.y = 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
style.cornerRadius = 10;
|
||||
style.textOffset.x = 8;
|
||||
style.textOffset.y = 4;
|
||||
style.textOffset.y = 8;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -337,6 +327,21 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleOfAccessNode()
|
||||
return style;
|
||||
}
|
||||
|
||||
GraphViewStyle::NodeStyle GraphViewStyle::getStyleOfExpandToggleNode()
|
||||
{
|
||||
NodeStyle style;
|
||||
|
||||
style.color = "#FFFFFF";
|
||||
style.borderColor = "#00000000";
|
||||
|
||||
style.cornerRadius = 12;
|
||||
|
||||
style.fontName = getFontNameOfExpandToggleNode();
|
||||
style.fontSize = getFontSizeOfExpandToggleNode();
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
GraphViewStyle::EdgeStyle GraphViewStyle::getStyleForEdgeType(Edge::EdgeType type, bool isActive, bool isFocused)
|
||||
{
|
||||
EdgeStyle style;
|
||||
|
||||
@@ -81,17 +81,19 @@ public:
|
||||
|
||||
static size_t getFontSizeForNodeType(Node::NodeType type);
|
||||
static size_t getFontSizeOfAccessNode();
|
||||
static size_t getFontSizeOfNumber();
|
||||
static size_t getFontSizeOfExpandToggleNode();
|
||||
|
||||
static std::string getFontNameForNodeType(Node::NodeType type);
|
||||
static std::string getFontNameOfAccessNode();
|
||||
static std::string getFontNameOfNumber();
|
||||
static std::string getFontNameOfExpandToggleNode();
|
||||
|
||||
static NodeMargins getMarginsForNodeType(Node::NodeType type, bool hasChildren);
|
||||
static NodeMargins getMarginsOfAccessNode(bool expanded, size_t subNodeCount, size_t invisibleSubNodeCount);
|
||||
static NodeMargins getMarginsOfAccessNode();
|
||||
static NodeMargins getMarginsOfExpandToggleNode();
|
||||
|
||||
static NodeStyle getStyleForNodeType(Node::NodeType type, bool isActive, bool isFocused, bool hasChildren);
|
||||
static NodeStyle getStyleOfAccessNode();
|
||||
static NodeStyle getStyleOfExpandToggleNode();
|
||||
|
||||
static EdgeStyle getStyleForEdgeType(Edge::EdgeType type, bool isActive, bool isFocused);
|
||||
|
||||
|
||||
@@ -50,45 +50,65 @@ struct DummyNode
|
||||
{
|
||||
public:
|
||||
DummyNode()
|
||||
: data(nullptr)
|
||||
, accessType(TokenComponentAccess::ACCESS_NONE)
|
||||
: visible(false)
|
||||
, childVisible(false)
|
||||
, topLevelAncestorId(0)
|
||||
, tokenId(0)
|
||||
, data(nullptr)
|
||||
, active(false)
|
||||
, connected(false)
|
||||
, aggregated(false)
|
||||
, expanded(false)
|
||||
, autoExpanded(false)
|
||||
, accessType(TokenComponentAccess::ACCESS_NONE)
|
||||
, invisibleSubNodeCount(0)
|
||||
, visible(false)
|
||||
, topLevelAncestorId(0)
|
||||
, tokenId(0)
|
||||
{
|
||||
}
|
||||
|
||||
bool isGraphNode() const
|
||||
{
|
||||
return data != nullptr;
|
||||
}
|
||||
|
||||
bool isAccessNode() const
|
||||
{
|
||||
return accessType != TokenComponentAccess::ACCESS_NONE;
|
||||
}
|
||||
|
||||
bool isExpandToggleNode() const
|
||||
{
|
||||
return !data && !isAccessNode();
|
||||
}
|
||||
|
||||
bool isExpanded() const
|
||||
{
|
||||
return expanded || autoExpanded;
|
||||
}
|
||||
|
||||
const Node* data;
|
||||
TokenComponentAccess::AccessType accessType;
|
||||
|
||||
Vec2i position;
|
||||
Vec2i size;
|
||||
|
||||
bool active;
|
||||
bool connected;
|
||||
bool aggregated;
|
||||
|
||||
bool expanded;
|
||||
bool autoExpanded;
|
||||
size_t invisibleSubNodeCount;
|
||||
|
||||
bool visible;
|
||||
bool childVisible;
|
||||
|
||||
Id topLevelAncestorId;
|
||||
Id tokenId;
|
||||
|
||||
std::vector<DummyNode> subNodes;
|
||||
|
||||
// GraphNode
|
||||
const Node* data;
|
||||
bool active;
|
||||
bool connected;
|
||||
bool aggregated;
|
||||
bool expanded;
|
||||
bool autoExpanded;
|
||||
|
||||
// AccessNode
|
||||
TokenComponentAccess::AccessType accessType;
|
||||
|
||||
// ExpandToggleNode
|
||||
size_t invisibleSubNodeCount;
|
||||
};
|
||||
|
||||
#endif // GRAPH_NODE_H
|
||||
|
||||
Reference in New Issue
Block a user