Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion demos/diagram-builder/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,15 @@ <h1>AlloyUI - Diagram builder</h1>
]
}).render();

var clickFn = function (connector) {
console.log(connector.get('name'));
console.log(connector.getAttrs().transition.source);
console.log(connector.getAttrs().transition.target);
};

diagramBuilder.connectAll([
{
connector: { name: 'Link0' },
connector: { name: 'Link0', onMouseMove: clickFn, showName: false },
source: 'Start0',
target: 'Condition0'
},
Expand Down
33 changes: 31 additions & 2 deletions src/aui-diagram-builder/js/aui-diagram-builder-connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ A.Connector = A.Base.create('line', A.Base, [], {
* @param event
* @protected
*/
_onShapeMouseEnter: function() {
_onShapeMouseEnter: function(event) {
var instance = this;

if (!instance.get('selected')) {
Expand All @@ -551,6 +551,8 @@ A.Connector = A.Base.create('line', A.Base, [], {
instance._updateShape(instance.shapeArrow, shapeArrowHover, false);
}
}

instance._onShapeMouseMove('mouseEnter', event)
},

/**
Expand All @@ -560,13 +562,28 @@ A.Connector = A.Base.create('line', A.Base, [], {
* @param event
* @protected
*/
_onShapeMouseLeave: function() {
_onShapeMouseLeave: function(event) {
var instance = this;

if (!instance.get('selected')) {
instance._updateShape(instance.shape, instance.get('shape'), false);
instance._updateShape(instance.shapeArrow, instance.get('shapeArrow'), false);
}

instance._onShapeMouseMove('mouseLeave', event)
},

_onShapeMouseMove: function(eventName, event) {
var instance = this;

var attrs = {
event: eventName,
clientX: event.clientX,
clientY: event.clientY,
name: instance.getAttrs().name
};

eval(instance.get('onMouseMove'))(attrs);
},

/**
Expand Down Expand Up @@ -729,6 +746,18 @@ A.Connector = A.Base.create('line', A.Base, [], {
*/
ATTRS: {

/**
* Function in string that is called when mouse enter and leaves the connector
*
* @attribute onMouseMove
* @default '(function() {})'
* @type String
*/
onMouseMove: {
value: "(function() {})",
validator: isString
},

/**
* Arrow points from `A.PolygonUtil` instance.
*
Expand Down