Skip to content

Commit

Permalink
#27 pool and lane drop event
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungpilPark committed Aug 23, 2017
1 parent 20201e0 commit e720f22
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 24 deletions.
1 change: 1 addition & 0 deletions src/main/webapp/examples/develope.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
canvas._CONFIG.WHEEL_SCALABLE = true;
canvas._CONFIG.DRAG_PAGE_MOVABLE = true;
canvas._CONFIG.AUTOMATIC_GUIDANCE = false;
canvas._CONFIG.POOL_DROP_EVENT = true;

canvas.initConfig({
selectable: true,
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/opengraph/OpenGraph-0.1.3-SNAPSHOT-All.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main/webapp/opengraph/OpenGraph-0.1.3-SNAPSHOT-min.js

Large diffs are not rendered by default.

23 changes: 16 additions & 7 deletions src/main/webapp/opengraph/OpenGraph-0.1.3-SNAPSHOT.js
Original file line number Diff line number Diff line change
Expand Up @@ -21989,7 +21989,7 @@ OG.renderer.RaphaelRenderer.prototype._drawLabel = function (position, text, siz
* @return {Element} Group DOM Element with geometry
* @override
*/
OG.renderer.RaphaelRenderer.prototype.drawShape = function (position, shape, size, style, id, preventEvent) {
OG.renderer.RaphaelRenderer.prototype.drawShape = function (position, shape, size, style, id, preventEvent, preventDropEvent) {
var width = size ? size[0] : 100,
height = size ? size[1] : 100,
groupNode, geometry, text, image, html, xml,
Expand Down Expand Up @@ -22148,6 +22148,10 @@ OG.renderer.RaphaelRenderer.prototype.drawShape = function (position, shape, siz
$(this._PAPER.canvas).trigger('drawShape', [groupNode]);
}

if (me._CONFIG.POOL_DROP_EVENT && !id && !preventDropEvent && me.isTopGroup(groupNode) && (me.isLane(groupNode) || me.isPool(groupNode))) {
me.setDropablePool(groupNode);
}

return groupNode;
};

Expand Down Expand Up @@ -26907,7 +26911,7 @@ OG.renderer.RaphaelRenderer.prototype.divideLane = function (element, quarterOrd
if (i === quarterLength - 1) {
_height = _height + (targetArea.getHeight() % quarterLength);
}
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], new OG.HorizontalLaneShape(), [_width, _height], null, null, element.id, true);
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], new OG.HorizontalLaneShape(), [_width, _height], null, null, element.id, true, true);
divedLanes.push(newLane);
}

Expand All @@ -26919,7 +26923,7 @@ OG.renderer.RaphaelRenderer.prototype.divideLane = function (element, quarterOrd
if (i === quarterLength - 1) {
_width = _width + (targetArea.getWidth() % quarterLength);
}
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], new OG.VerticalLaneShape(), [_width, _height], null, null, element.id, true);
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], new OG.VerticalLaneShape(), [_width, _height], null, null, element.id, true, true);
divedLanes.push(newLane);
}
me.fitLaneOrder(element);
Expand Down Expand Up @@ -26951,7 +26955,7 @@ OG.renderer.RaphaelRenderer.prototype.divideLane = function (element, quarterOrd
var x = targetUpperLeft.x;
var y = targetUpperLeft.y;
var shape = me.isHorizontalLane(element) ? new OG.HorizontalLaneShape() : new OG.VerticalLaneShape();
standardLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], shape, [_width, _height], null, null, element.id, true);
standardLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], shape, [_width, _height], null, null, element.id, true, true);
divedLanes.push(standardLane);
}

Expand Down Expand Up @@ -27053,7 +27057,7 @@ OG.renderer.RaphaelRenderer.prototype.divideLane = function (element, quarterOrd
}
}
});
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], shape, [_width, _height], null, null, parent.id, true);
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], shape, [_width, _height], null, null, parent.id, true, true);
divedLanes.push(newLane);
$.each(lanesToMove, function (index, laneToMove) {
me.move(laneToMove, moveOffset);
Expand Down Expand Up @@ -34723,6 +34727,10 @@ OG.graph.Canvas = function (container, containerSize, backgroundColor, backgroun

this._CONFIG = {

/**
* 풀, 래인 도형의 드랍시 자동 위치 조정 기능
*/
POOL_DROP_EVENT: false,
/**
* 도형, 스팟 이동시 이웃한 도형에 대해 자동보정이 이루어지는 여부.
*/
Expand Down Expand Up @@ -36132,11 +36140,12 @@ OG.graph.Canvas.prototype = {
* @param {String} id Element ID 지정 (Optional)
* @param {String} parentId 부모 Element ID 지정 (Optional)
* @param {Boolean} preventEvent 이벤트 생성 방지
* @param {Boolean} preventDropEvent 드랍 이벤트 방지
* @return {Element} Group DOM Element with geometry
*/
drawShape: function (position, shape, size, style, id, parentId, preventEvent) {
drawShape: function (position, shape, size, style, id, parentId, preventEvent, preventDropEvent) {

var element = this._RENDERER.drawShape(position, shape, size, style, id, preventEvent);
var element = this._RENDERER.drawShape(position, shape, size, style, id, preventEvent, preventDropEvent);

if (position && (shape.TYPE === OG.Constants.SHAPE_TYPE.EDGE)) {
element = this._RENDERER.move(element, position);
Expand Down
9 changes: 7 additions & 2 deletions src/main/webapp/src/graph/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ OG.graph.Canvas = function (container, containerSize, backgroundColor, backgroun

this._CONFIG = {

/**
* 풀, 래인 도형의 드랍시 자동 위치 조정 기능
*/
POOL_DROP_EVENT: false,
/**
* 도형, 스팟 이동시 이웃한 도형에 대해 자동보정이 이루어지는 여부.
*/
Expand Down Expand Up @@ -1437,11 +1441,12 @@ OG.graph.Canvas.prototype = {
* @param {String} id Element ID 지정 (Optional)
* @param {String} parentId 부모 Element ID 지정 (Optional)
* @param {Boolean} preventEvent 이벤트 생성 방지
* @param {Boolean} preventDropEvent 드랍 이벤트 방지
* @return {Element} Group DOM Element with geometry
*/
drawShape: function (position, shape, size, style, id, parentId, preventEvent) {
drawShape: function (position, shape, size, style, id, parentId, preventEvent, preventDropEvent) {

var element = this._RENDERER.drawShape(position, shape, size, style, id, preventEvent);
var element = this._RENDERER.drawShape(position, shape, size, style, id, preventEvent, preventDropEvent);

if (position && (shape.TYPE === OG.Constants.SHAPE_TYPE.EDGE)) {
element = this._RENDERER.move(element, position);
Expand Down
18 changes: 7 additions & 11 deletions src/main/webapp/src/renderer/RaphaelRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ OG.renderer.RaphaelRenderer.prototype._drawLabel = function (position, text, siz
* @return {Element} Group DOM Element with geometry
* @override
*/
OG.renderer.RaphaelRenderer.prototype.drawShape = function (position, shape, size, style, id, preventEvent) {
OG.renderer.RaphaelRenderer.prototype.drawShape = function (position, shape, size, style, id, preventEvent, preventDropEvent) {
var width = size ? size[0] : 100,
height = size ? size[1] : 100,
groupNode, geometry, text, image, html, xml,
Expand Down Expand Up @@ -1431,12 +1431,8 @@ OG.renderer.RaphaelRenderer.prototype.drawShape = function (position, shape, siz
$(this._PAPER.canvas).trigger('drawShape', [groupNode]);
}

if (!id && (me.isLane(groupNode) || me.isPool(groupNode))) {
if(me.isTopGroup(groupNode)){
console.log('top');
me.setDropablePool(groupNode);
}
//me.isTopGroup(element)
if (me._CONFIG.POOL_DROP_EVENT && !id && !preventDropEvent && me.isTopGroup(groupNode) && (me.isLane(groupNode) || me.isPool(groupNode))) {
me.setDropablePool(groupNode);
}

return groupNode;
Expand Down Expand Up @@ -6198,7 +6194,7 @@ OG.renderer.RaphaelRenderer.prototype.divideLane = function (element, quarterOrd
if (i === quarterLength - 1) {
_height = _height + (targetArea.getHeight() % quarterLength);
}
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], new OG.HorizontalLaneShape(), [_width, _height], null, null, element.id, true);
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], new OG.HorizontalLaneShape(), [_width, _height], null, null, element.id, true, true);
divedLanes.push(newLane);
}

Expand All @@ -6210,7 +6206,7 @@ OG.renderer.RaphaelRenderer.prototype.divideLane = function (element, quarterOrd
if (i === quarterLength - 1) {
_width = _width + (targetArea.getWidth() % quarterLength);
}
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], new OG.VerticalLaneShape(), [_width, _height], null, null, element.id, true);
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], new OG.VerticalLaneShape(), [_width, _height], null, null, element.id, true, true);
divedLanes.push(newLane);
}
me.fitLaneOrder(element);
Expand Down Expand Up @@ -6242,7 +6238,7 @@ OG.renderer.RaphaelRenderer.prototype.divideLane = function (element, quarterOrd
var x = targetUpperLeft.x;
var y = targetUpperLeft.y;
var shape = me.isHorizontalLane(element) ? new OG.HorizontalLaneShape() : new OG.VerticalLaneShape();
standardLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], shape, [_width, _height], null, null, element.id, true);
standardLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], shape, [_width, _height], null, null, element.id, true, true);
divedLanes.push(standardLane);
}

Expand Down Expand Up @@ -6344,7 +6340,7 @@ OG.renderer.RaphaelRenderer.prototype.divideLane = function (element, quarterOrd
}
}
});
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], shape, [_width, _height], null, null, parent.id, true);
var newLane = me._CANVAS.drawShape([x + (_width / 2), y + (_height / 2)], shape, [_width, _height], null, null, parent.id, true, true);
divedLanes.push(newLane);
$.each(lanesToMove, function (index, laneToMove) {
me.move(laneToMove, moveOffset);
Expand Down

0 comments on commit e720f22

Please sign in to comment.