Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let DependenciesManager = function (gantt, pluginScope, api) {
let self = this
this.gantt = gantt
this.pluginScope = pluginScope
this.api = api
this.api.registerEvent('dependencies', 'add')
this.api.registerEvent('dependencies', 'change')
this.api.registerEvent('dependencies', 'remove')
this.plumb = jsplumb.jsPlumb ? jsplumb.jsPlumb.getInstance() : jsplumb.getInstance() // Workaround for build issue.
this.plumb.importDefaults(this.pluginScope.jsPlumbDefaults)
this.dependenciesFrom = {}
this.dependenciesTo = {}
this.tasksList = []
this.tasks = {}
this.events = new GanttDependenciesEvents(this)
this.pluginScope.$watch('enabled', function (newValue, oldValue) {
if (newValue !== oldValue) {
self.refresh()
}
})
connect: function() {
const chartOptions = _.defaults({
container: this.id()
}, this.defaultsChartOptions);
this.jsPlumbInstance = jsPlumb.getInstance(chartOptions);
this.jsPlumbInstance.eventBus = Object.create(Backbone.Events);
if (this.chartHandlers) {
this.listenTo(this.jsPlumbInstance.eventBus, this.chartHandlers);
}
this.debouncedRepaintEverything = _.debounce(this.repaintEverything.bind(this), 0);
this.jsPlumbManager = new JPManager(this.jsPlumbInstance, this.model);
const stepWithPosition = this.model.get('steps').find(function(step) {
const position = step.get('position');
return _.isArray(position) && position.length === 2;
});
// if positions of step wasn't defined
if (_.isUndefined(stepWithPosition)) {
this.jsPlumbManager.organizeBlocks();
}
},
ret = parseInt(hint_anns[0].value());
//ll('extracted coord ' + x_or_y + ': ' + ret);
}else if( hint_anns.length === 0 ){
//ll('no coord');
}else{
//ll('too many coord');
}
return ret;
}
///
/// jsPlumb preamble.
///
var instance = jsPlumb.getInstance(
{
// All connections have these properties.
DragOptions: {ccursor: 'pointer', zIndex:2000 },
Endpoints : ["Rectangle", ["Dot", { radius:8 } ]],
//Endpoints : [["Dot", { radius:8 } ], "Rectangle"],
EndpointStyles : [
{
width: 15,
height: 15,
//strokeStyle: '#000000',
fillStyle: "#666666" // subject endpoint color
},
{
fillStyle: "#0d78bc" // object endpoint
//fillStyle: "#006"
}