Skip to content

Commit

Permalink
Fix terminal-dragedit without layer
Browse files Browse the repository at this point in the history
  • Loading branch information
ericabouaf committed Jun 17, 2012
1 parent 8cf6ad6 commit d684736
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/3-container.html
Expand Up @@ -77,7 +77,7 @@


src: c1.item(1),
tgt: c2.item(0),
tgt: c2.item(0)

});

Expand Down
7 changes: 5 additions & 2 deletions examples/6-form-container.html
Expand Up @@ -21,17 +21,20 @@
window.Y = Y;

var layerEl = Y.one('#layer');
var mygraphic = new Y.Graphic({render: "#layer"});

c1 = new Y.FormContainer({
children: [
{
align: {points:["tl", "tc"]},
dir: [0,-1],
groups: ['string']
groups: ['string'],
graphic: mygraphic
},
{
align: {points:["tl", "bc"]}, dir: [0, 1],
groups: ['object']
groups: ['object'],
graphic: mygraphic
}
],

Expand Down
2 changes: 1 addition & 1 deletion src/loader.js
Expand Up @@ -25,7 +25,7 @@ YUI().use(function(Y) {
requires: ['widget','widget-child','widget-position','widget-position-align','wire-base', 'wires-delegate']
},
'terminal-dragedit': {
requires: ['dd-drop', 'dd-drag','dd-proxy']
requires: ['bezier-wire', 'dd-drop', 'dd-drag','dd-proxy']
},
'terminal-scissors': {
requires: ['overlay']
Expand Down
23 changes: 16 additions & 7 deletions src/terminal-dragedit/terminal-dragedit.js
Expand Up @@ -27,6 +27,10 @@ Y.TerminalDragEdit.ATTRS = {

"editwire-class": {
value: Y.BezierWire
},

graphic: {
value: null
}

};
Expand Down Expand Up @@ -86,13 +90,18 @@ Y.TerminalDragEdit.prototype = {
var dir = this.get('dir');
var that = this;

// TODO: console.log( this.get('editwire-class') );
if(!this.get('graphic')) {
this.set('graphic', this.get('root').graphic);
}

this.drag.wire = this.get('root').graphic.addShape({
type: Y.BezierWire, //,editwire-class
stroke: {
weight: 4,
color: "rgb(173,216,230)"
this.drag.wire = this.get('graphic').addShape({

type: this.get('editwire-class'),

// TODO: customizable
stroke: {
weight: 4,
color: "rgb(173,216,230)"
},

src: {
Expand Down Expand Up @@ -164,4 +173,4 @@ Y.TerminalDragEdit.prototype = {

};

}, '3.5.1', {requires: ['dd-drop', 'dd-drag', 'dd-proxy']});
}, '3.5.1', {requires: ['bezier-wire', 'dd-drop', 'dd-drag', 'dd-proxy']});
14 changes: 11 additions & 3 deletions src/wireit-app/wireit-app.js
Expand Up @@ -335,10 +335,18 @@ Y.EditorView = Y.Base.create('editorView', Y.View, [], {

// TODO: wire.config;

var w = new Y.BezierWire({
src: srcTerminal,
var w = layer.graphic.addShape({
type: Y.BezierWire,
stroke: {
weight: 4,
color: "rgb(173,216,230)"
},


src: srcTerminal,
tgt: tgtTerminal
}).render( layer.get('contentBox') );

});

});

Expand Down

0 comments on commit d684736

Please sign in to comment.