Re: [Vala] Diagram rendering via Clutter



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 06/30/2015 12:44 PM, Козлов Кирилл wrote:
Hello,

Please give me an advice on what Clutter objects should be used
for implementing diagram editor. Objects on the diagram can be 
connected via lines, can be moved, deleted (like it's done in Dia, 
for example). Any help or shared experience will be appreciated.


Hi, Kirill

I've done the "how to connect objects graphically" problem recently in
my project rainbow-lollipop [0]

I don't know if this is the nonplusultra way, but what i did was: I
defined myself a custom constraint which i called "ConnectorConstraint".

Let's assume we have 3 actors:

Actor A   ->  An actor that we want to connect with another
Actor B   ->  The actor that we want to connect A to
Connector ->  An actor that draws a connection (e.g. a line) between
the two

The ConnectorConstraint is initialized with the Actors A and B.
Everytime the allocations of A or B change, the constraint will
allocate itself appropiately between A and B. We assign the
Connector-Actor the ConnectorConstraint and voilá, We have connectors.

Releveant sourcecode can be found here [1] in lines 38 to 127

Hope this helps,
    Grindhold

[0] https://github.com/grindhold/rainbow-lollipop
[1]
https://github.com/grindhold/rainbow-lollipop/blob/master/src/nodes.vala




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVkojhAAoJEBuqgJs6izSEAtMQAIyISJzA0EANiPLVvZC7uw9f
2S5NOS4nGTEU+BBlLWeA1nhqMvD18rrPSS372K5AZDsQBTdTUzB/EEK4IHw1kJti
ksdpyWD67pP84c/sDV50HCOP3Djx33XbAvJ8bPKzSD1HeJE+rulT/cFsGacoZj1F
erjnl19OWrX6EGKRt8USJr/2CwJVqmvVYmHpH2jvsE9mPFHf0iDebuU/EMHTneWB
6B9EIEwejURKzUs4JWi+g7BjUfd8ISuBGpY45PYGUqz7n8bvPhIuKGkSQqI5Tn7N
70U+7ocnH7PVJleilZLehBl8fJk2saBypnF3qrQ2ttgubLJrGVveXKTc9M3IA7a0
bP97YEeB4Q5XpnDuYpgFaOPfXf4pbdOWGl1VVZCOqm7FUgxdCGg6D5I4TgGAIs83
3fZIvPK2VyNNhfZAWrD0I9XNjhDIkKCsDF6ZEer6rdywumHokQUFSyKDCbTTw+T1
CDVMLI4n5eFOVY1oXYFGmmMvyNIPVQ5dgMcpluukyom5cBjPZCYKeUjDdRBysS6X
/K3BeHgvkrYpoFCXRwGMk8SLEz/HUV4cCuGfNfASHkkW8388JPvpmQtP27atJgvv
YzQz2PjL7Z2e/e/MzENSgvscAW/IZZatG6yplf7NYidDZLTQ46BTehzr7OWsHPjY
2Xvwo8Y2UhhN01VD6+Z2
=W5gC
-----END PGP SIGNATURE-----


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]