-
Notifications
You must be signed in to change notification settings - Fork 1
/
MyInterceptorPolicy.js
35 lines (28 loc) · 1.17 KB
/
MyInterceptorPolicy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var MyInterceptorPolicy = draw2d.policy.canvas.DropInterceptorPolicy.extend({
init : function(attr, getter, setter)
{
this._super(attr, getter, setter);
},
/**
* @method
* Called if the user want drop a port over any draw2d.Figure.<br>
* Return a non <b>null</b> value if the interceptor accept the drop event.<br>
* <br>
* It is possible to delegate the drop event to another figure if the policy
* returns another figure. This is useful if a figure want to accept a port
* drop event and delegates this drop event to another port.<br>
*
*
* @param {draw2d.Figure} requestingFigure the figure who wants connect
* @param {draw2d.Figure} connectTarget the potential connect target determined by the framework
*/
delegateTarget: function(requestingFigure, connectTarget)
{
// we allow that a figure with a special class is droppable to a connection
//
if(requestingFigure instanceof VoltageSource && connectTarget instanceof draw2d.Connection){
return connectTarget;
}
return this._super(requestingFigure, connectTarget);
}
});