feat(Modeler+Viewer): correctly use BpmnRenderer

This commit is contained in:
Nico Rehwaldt 2014-04-09 10:50:20 +02:00
parent 3db137a0ce
commit 9d1dd58ac5
3 changed files with 21 additions and 9 deletions

View File

@ -3,8 +3,6 @@ var Diagram = require('diagram-js');
var bpmnModule = require('./di').defaultModule, var bpmnModule = require('./di').defaultModule,
Viewer = require('./Viewer'); Viewer = require('./Viewer');
require('./core/BpmnRegistry');
require('./draw/BpmnRenderer'); require('./draw/BpmnRenderer');
require('diagram-js/lib/features/dnd/Visuals'); require('diagram-js/lib/features/dnd/Visuals');
@ -29,7 +27,7 @@ Modeler.prototype.createDiagram = function() {
return new Diagram({ return new Diagram({
canvas: { container: this.container }, canvas: { container: this.container },
modules: [ bpmnModule ], modules: [ bpmnModule ],
components: [ 'selectionVisuals', 'dragVisuals', 'bpmnRegistry'] components: [ 'selectionVisuals', 'dragVisuals' ]
}); });
}; };

View File

@ -1,12 +1,18 @@
var Diagram = require('diagram-js'); var Diagram = require('diagram-js'),
var Importer = require('./import/Importer'),
BpmnModel = require('bpmn-moddle'), BpmnModel = require('bpmn-moddle'),
failSafeAsync = require('./Util').failSafeAsync,
fs = require('fs'), fs = require('fs'),
$ = require('jquery'), $ = require('jquery'),
_ = require('lodash'); _ = require('lodash');
var Importer = require('./import/Importer'),
failSafeAsync = require('./Util').failSafeAsync;
var bpmnModule = require('./di').defaultModule;
require('./draw/BpmnRenderer');
require('diagram-js/lib/features/selection/Visuals');
function getSvgNode(diagram) { function getSvgNode(diagram) {
var paper = diagram.get('canvas').getPaper(); var paper = diagram.get('canvas').getPaper();
return paper.node; return paper.node;
@ -50,7 +56,7 @@ function Viewer(options) {
var logoData = fs.readFileSync('resources/bpmnjs.png', 'base64'); var logoData = fs.readFileSync('resources/bpmnjs.png', 'base64');
var a = $('<a href="http://bpmn.io" target="_blank" draggable="false" />').css({ var a = $('<a href="http://bpmn.io" target="_blank" title="Powered by bpmn.io" draggable="false" />').css({
position: 'absolute', position: 'absolute',
bottom: 15, bottom: 15,
right: 15, right: 15,
@ -153,7 +159,12 @@ Viewer.prototype.initDiagram = function(diagram) {
}; };
Viewer.prototype.createDiagram = function() { Viewer.prototype.createDiagram = function() {
return new Diagram({ canvas: { container: this.container }});
return new Diagram({
canvas: { container: this.container },
modules: [ bpmnModule ],
components: [ 'selectionVisuals' ]
});
}; };
Viewer.prototype.clear = function() { Viewer.prototype.clear = function() {

View File

@ -3,6 +3,9 @@ var bpmnModule = require('../di').defaultModule;
require('diagram-js/lib/core/EventBus'); require('diagram-js/lib/core/EventBus');
require('diagram-js/lib/draw/Styles'); require('diagram-js/lib/draw/Styles');
require('../core/BpmnRegistry');
var DefaultRenderer = require('diagram-js/lib/draw/Renderer'); var DefaultRenderer = require('diagram-js/lib/draw/Renderer');