mirror of
https://github.com/rgleichman/glance.git
synced 2024-08-17 02:40:28 +03:00
Connect nodes with edges.
This commit is contained in:
parent
bbd2a73eed
commit
683c3f23e2
10
gui/Main.hs
10
gui/Main.hs
@ -405,7 +405,7 @@ clickOnNode ::
|
||||
(Double, Double) -> -- Click position where (0,0) is top left of element
|
||||
AppState ->
|
||||
AppState
|
||||
clickOnNode elemId relativePosition oldState@AppState {_asMovingNode, _asHistory, _asElements} =
|
||||
clickOnNode elemId relativePosition oldState@AppState {_asMovingNode, _asHistory, _asElements, _asCurrentEdge, _asEdges} =
|
||||
let portClicked = case IntMap.lookup (_unElemId elemId) _asElements of
|
||||
Nothing -> Nothing
|
||||
Just element ->
|
||||
@ -413,7 +413,13 @@ clickOnNode elemId relativePosition oldState@AppState {_asMovingNode, _asHistory
|
||||
in case _asMovingNode of
|
||||
Nothing -> case portClicked of
|
||||
Nothing -> oldState {_asMovingNode = Just elemId}
|
||||
_ -> oldState
|
||||
Just _port -> case _asCurrentEdge of
|
||||
Nothing -> oldState {_asCurrentEdge = Just elemId}
|
||||
Just edgeElemId ->
|
||||
oldState
|
||||
{ _asEdges = (edgeElemId, elemId) : _asEdges,
|
||||
_asCurrentEdge = Nothing
|
||||
}
|
||||
Just _ ->
|
||||
addHistoryEvent MovedNode $
|
||||
oldState {_asMovingNode = Nothing}
|
||||
|
11
todo.md
11
todo.md
@ -9,12 +9,21 @@
|
||||
* Add wiki pages discussing: Why a visual language?, History of Glance, How to contribute, Code guide [code style, ...], etc..
|
||||
|
||||
## GUI Todo Later
|
||||
* Connect nodes with lines
|
||||
* Connect edges to specific ports
|
||||
* Select areas by clicking the vertices of the selection area.
|
||||
* Have a way to delete nodes and edges
|
||||
* Display the undo state in the app [Bug #14](https://github.com/rgleichman/glance/issues/14)
|
||||
* Scale based on mouse position
|
||||
* Add edge creation to history.
|
||||
* Extract out GUI interface code (GTK and GDK) into a module.
|
||||
* Refactor to make code extensible (e.g. records of functions instead of enums)
|
||||
* Click a button that shows an image of the mouse and keyboard controls in a new window.
|
||||
* Consider a way to keep the currentEdge after creating an edge. May
|
||||
be useful where a variable is used mulitple times (e.g. a big struct
|
||||
parameter).
|
||||
* Create functions by connecting a second edge to an apply argument
|
||||
port and then selecting the second output (or maybe just the select
|
||||
the output of the function and connect the function up later?)
|
||||
|
||||
### Testing todos
|
||||
* Fix the arrowheads being too big for SyntaxGraph drawings.
|
||||
|
Loading…
Reference in New Issue
Block a user