From f02b741c85ccd8c42c23d157c413ca80f352baa1 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 18 Jul 2014 15:29:41 +0200 Subject: [PATCH] feat(features/context-pad): focus elements after append --- lib/features/context-pad/ContextPadProvider.js | 10 +++++++--- lib/features/context-pad/index.js | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/features/context-pad/ContextPadProvider.js b/lib/features/context-pad/ContextPadProvider.js index df3b7901..9cab6484 100644 --- a/lib/features/context-pad/ContextPadProvider.js +++ b/lib/features/context-pad/ContextPadProvider.js @@ -20,21 +20,23 @@ var images = { * * @param {ContextPad} contextPad */ -function ContextPadProvider(contextPad, directEditing, bpmnModeling) { +function ContextPadProvider(contextPad, directEditing, bpmnModeling, selection) { contextPad.registerProvider(this); + this._selection = selection; this._directEditing = directEditing; this._bpmnModeling = bpmnModeling; } -ContextPadProvider.$inject = [ 'contextPad', 'directEditing', 'bpmnModeling' ]; +ContextPadProvider.$inject = [ 'contextPad', 'directEditing', 'bpmnModeling', 'selection' ]; ContextPadProvider.prototype.getContextPadEntries = function(element) { var directEditing = this._directEditing, - bpmnModeling = this._bpmnModeling; + bpmnModeling = this._bpmnModeling, + selection = this._selection; var actions = {}; @@ -46,6 +48,8 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) { function append(element, type) { var target = bpmnModeling.appendFlowNode(element, null, type); + + selection.select(target); directEditing.activate(target); } diff --git a/lib/features/context-pad/index.js b/lib/features/context-pad/index.js index 0d6dd713..40bb3b5b 100644 --- a/lib/features/context-pad/index.js +++ b/lib/features/context-pad/index.js @@ -1,6 +1,7 @@ module.exports = { __depends__: [ require('diagram-js/lib/features/context-pad'), + require('diagram-js/lib/features/selection'), require('diagram-js-direct-editing'), require('../bpmn-modeling') ],