Looks good!!!! You are @embee on Slack right ? :-) Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> On Nov 19, 2015, at 4:03 PM, Martin Bähr <mba...@email.archlab.tuwien.ac.at> > wrote: > > Excerpts from stepharo's message of 2015-08-22 09:55:04 +0200: >> would be fun to see if you can reuse the algo of roassal. > > i have taken a stab at that: > > =========================================================================================== > view := RTView new. > | activenode prevnode | > > view > when: TRMouseClick > do: > [ :ev | > | label node | > "node := shape element." > label := RTEditableLabel new > height: 30; "i have a very high resolution and like > large fonts" > text: ''; > element. > node := RTBox new > color: Color white; > borderWidth: 2; > borderColor: Color black; > element. > node @ RTDraggable. > > "select a node to branch of new nodes from it" > node when: TRMouseClick do: [ :click | activenode := click > element ]. > > "if the label is empty: '', then its size is 0@0 and is no > longer clickable to edit, hence we make the node clickable > instead" > node when: TRMouseDoubleClick do: [ label shape > showTextMorphFor: label ]. > node when: TRMouseLeave do: [ label shape hideTextMorphFor: > label ]. > view > add: node; > add: label. > RTNest new > stretchable; > on: node nest: {label}. > > "when the label changes its size, the box doesn't update its > size unless we add this workaround" > label trachelShape addCallback: (TRExtentCallback new block: [ > :aShape :ratio | node trachelShape extent: aShape extent + (20 @ 0) ]). > > node translateTo: ev position. > > "label shape showTextMorphFor: label." "this opens the node in > edit mode, > but somehow messes > things up" > > (activenode notNil and: node ~= activenode) > ifTrue: [ prevnode := activenode ]. > prevnode > ifNotNil: [ edge := RTEdge from: prevnode to: node. > edge > + > (RTBezierLine horizontal > > withContinuousRectangleAttachPoint; > yourself). > view add: edge ]. > prevnode := node. > activenode := node. > view signalUpdate ]. > view. > =========================================================================================== > > the behavior is a bit different than the usual mindmapping tools as it does > not > enforce an automatic layout but you are free to place nodes whereever you like > by just clicking in the location and moving the node later. > > that behavior is inspired by a mindmapping tool called labyrint: > https://github.com/labyrinth-team/labyrinth > https://www.youtube.com/watch?v=Pv3dTovGc0E > > > thanks to alexandre bergel and others who helped me to figure out some > problems such as a workaround for RTEditableLabel not working with > RTCompositeShape: > > shape := RTCompositeShape new. > shape allOfSameSizeWithPadding. > shape add: (RTBox new color: Color white; borderWidth: 2; borderColor: Color > black). > shape add: (RTEditableLabel new height: 30). > > the remaining problems are cosmetic. for example i can't seem to get the nodes > to open up in edit mode. doing that with the commented line in the code above, > wrecks havoc on the node. > i also would like RTBezierLine to be horizontal or vertical depending on how > the two nodes are positioned to each other. and it should always start at the > middle of the rectangles edge at a 90degree angle. > > lastly, i'd like to have rounded corners on the RTBox. > > if/when i develop this further, i plan to add the ability to select multiple > nodes and add edges between them. be able to move selected nodes as a group, > and align selected (or all) nodes according to one of the layouts provided by > roassal (tree, circle, etc), things like export to svg or png would also be > nice. > > and of course, package it up... > > greetings, martin. > > -- > eKita - the online platform for your entire academic life > -- > chief engineer eKita.co > pike programmer pike.lysator.liu.se caudium.net societyserver.org > secretary beijinglug.org > mentor fossasia.org > foresight developer foresightlinux.org realss.com > unix sysadmin > Martin Bähr working in china http://societyserver.org/mbaehr/ >