-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added pivoting btwn op defs and pipeline. Fixes #232
- Loading branch information
Showing
4 changed files
with
110 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/*globals define, WebGMEGlobal*/ | ||
define([ | ||
'widgets/EasyDAG/Buttons' | ||
], function( | ||
EasyDAGButtons | ||
) { | ||
|
||
// Create a GoToBase button | ||
var client = WebGMEGlobal.Client, | ||
LocalOps = { | ||
ArtifactLoader: true, | ||
Save: true | ||
}; | ||
|
||
var GoToBase = function(params) { | ||
// Check if it should be disabled | ||
var baseId = this._getBaseId(params.item), | ||
base = client.getNode(baseId); | ||
|
||
params.disabled = base ? base.isLibraryElement() : false; | ||
EasyDAGButtons.ButtonBase.call(this, params); | ||
}; | ||
|
||
GoToBase.SIZE = 10; | ||
GoToBase.BORDER = 5; | ||
GoToBase.prototype.BTN_CLASS = 'add'; | ||
GoToBase.prototype = new EasyDAGButtons.ButtonBase(); | ||
|
||
GoToBase.prototype._render = function() { | ||
var lineRadius = GoToBase.SIZE - GoToBase.BORDER, | ||
btnColor = '#90caf9', | ||
lineColor = '#7986cb'; | ||
|
||
if (this.disabled) { | ||
btnColor = '#e0e0e0'; | ||
lineColor = '#9e9e9e'; | ||
} | ||
|
||
this.$el | ||
.append('circle') | ||
.attr('r', GoToBase.SIZE) | ||
.attr('fill', btnColor); | ||
|
||
this.$el | ||
.append('circle') | ||
//.attr('cx', -) | ||
//.attr('cy', 0) | ||
.attr('r', GoToBase.SIZE/3) | ||
.attr('stroke-width', 3) | ||
.attr('stroke', lineColor); | ||
|
||
this.$el | ||
.append('line') | ||
.attr('y1', 0) | ||
.attr('y2', 0) | ||
.attr('x1', -lineRadius) | ||
.attr('x2', lineRadius) | ||
.attr('stroke-width', 3) | ||
.attr('stroke', lineColor); | ||
|
||
}; | ||
|
||
GoToBase.prototype._onClick = function(item) { | ||
var node = client.getNode(item.id), | ||
baseId = node.getBaseId(); | ||
|
||
window.DeepForge = window.DeepForge || {}; | ||
window.DeepForge.lastPipeline = item.desc.parentId; | ||
|
||
WebGMEGlobal.State.registerActiveObject(baseId); | ||
}; | ||
|
||
GoToBase.prototype._getBaseId = function(item) { | ||
var n = client.getNode(item.id); | ||
return n.getBaseId(); | ||
}; | ||
|
||
return { | ||
DeleteOne: EasyDAGButtons.DeleteOne, | ||
GoToBase: GoToBase | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters