Skip to content

Commit abf972f

Browse files
author
SeungpilPark
committed
#22 Column resize bug fix
1 parent 41cad6f commit abf972f

6 files changed

Lines changed: 68 additions & 38 deletions

File tree

src/main/webapp/opengraph/OpenGraph-0.1.2-SNAPSHOT-All.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/webapp/opengraph/OpenGraph-0.1.2-SNAPSHOT-min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/webapp/opengraph/OpenGraph-0.1.2-SNAPSHOT.js

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17210,17 +17210,13 @@ OG.shape.component.DataTable = function () {
1721017210
shape.DELETABLE = false;
1721117211
shape.LABEL_EDITABLE = false;
1721217212
shape.RESIZABLE = false;
17213-
shape.onSelectShape = function () {
17214-
var me = this;
17215-
me.currentCanvas.setShapeStyle(me.currentElement, {
17216-
stroke: '#ff0100'
17217-
})
17218-
}
17219-
shape.onDeSelectShape = function () {
17220-
var me = this;
17221-
me.currentCanvas.setShapeStyle(me.currentElement, {
17222-
stroke: '#000'
17223-
})
17213+
shape.GUIDE_BBOX = {
17214+
stroke: "#ff5b00",
17215+
'stroke-width': 4,
17216+
fill: "white",
17217+
"fill-opacity": 0,
17218+
"shape-rendering": "crispEdges",
17219+
cursor: "move"
1722417220
}
1722517221
result.contents.push({
1722617222
/**
@@ -17251,6 +17247,8 @@ OG.shape.component.DataTable = function () {
1725117247

1725217248
//옵션데이터
1725317249
this.options = {
17250+
selectable: 'column',
17251+
1725417252
//mode: 'view',
1725517253
/**
1725617254
* 컨텐트 외부 드래그 가능 여부
@@ -18350,6 +18348,18 @@ OG.shape.component.DataTable.prototype.bindCellEvent = function () {
1835018348

1835118349
OG.shape.component.DataTable.prototype.createCellGuid = function (cellView) {
1835218350
var me = this;
18351+
18352+
if(me.options.selectable == 'column'){
18353+
if(cellView.type != 'column'){
18354+
return;
18355+
}
18356+
}
18357+
if(me.options.selectable == 'cell'){
18358+
if(cellView.type != 'cell'){
18359+
return;
18360+
}
18361+
}
18362+
1835318363
//기존 등록된 임시 셀을 모두 삭제토록.
1835418364
var childs = me.currentCanvas.getChilds(me.currentElement);
1835518365
for (var i = 0, leni = childs.length; i < leni; i++) {
@@ -23622,7 +23632,6 @@ OG.renderer.RaphaelRenderer.prototype.drawDropOverGuide = function (element) {
2362223632
};
2362323633

2362423634
OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
23625-
2362623635
var me = this, rElement = this._getREleById(OG.Util.isElement(element) ? element.id : element),
2362723636
geometry = rElement ? rElement.node.shape.geom : null,
2362823637
envelope,
@@ -23636,6 +23645,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
2363623645
_trash, isEdge, isEssensia, controllers = [], isLane,
2363723646
_qUpper, _qLow, _qBisector, _qThirds;
2363823647

23648+
var bboxStyle = element.shape.GUIDE_BBOX ? element.shape.GUIDE_BBOX : me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX;
2363923649

2364023650
var _isConnectable = rElement && me._CANVAS._HANDLER._isConnectable(element.shape);
2364123651
var _isConnectCloneable = rElement && me._CANVAS._HANDLER._isConnectCloneable(element.shape);
@@ -23707,7 +23717,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
2370723717
if (isEdge) {
2370823718
_bBoxRect = me._PAPER.rect(_upperLeft.x - 10, _upperLeft.y - 10, envelope.getWidth() + 20, envelope.getHeight() + 20);
2370923719
}
23710-
_bBoxRect.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX);
23720+
_bBoxRect.attr(bboxStyle);
2371123721
me._add(_bBoxRect, rElement.id + OG.Constants.GUIDE_SUFFIX.BBOX);
2371223722
guide.bBox = _bBoxRect.node;
2371323723
}
@@ -23720,7 +23730,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
2372023730
if (isEdge) {
2372123731
_bBoxRect = me._PAPER.rect(_upperLeft.x - 10, _upperLeft.y - 10, envelope.getWidth() + 20, envelope.getHeight() + 20);
2372223732
}
23723-
_bBoxRect.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX);
23733+
_bBoxRect.attr(bboxStyle);
2372423734
me._add(_bBoxRect, rElement.id + OG.Constants.GUIDE_SUFFIX.BBOX);
2372523735
}
2372623736

@@ -24297,6 +24307,8 @@ OG.renderer.RaphaelRenderer.prototype.drawEdgeGuide = function (element) {
2429724307
_size = me._CONFIG.GUIDE_RECT_SIZE, _hSize = OG.Util.round(_size / 2), _style = {},
2429824308
i;
2429924309

24310+
var bboxStyle = element.shape.GUIDE_BBOX ? element.shape.GUIDE_BBOX : me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX;
24311+
2430024312
if (rElement && geometry) {
2430124313
OG.Util.apply(_style, geometry.style.map, me._CONFIG.DEFAULT_STYLE.EDGE);
2430224314

@@ -24330,7 +24342,7 @@ OG.renderer.RaphaelRenderer.prototype.drawEdgeGuide = function (element) {
2433024342
}
2433124343

2433224344
_bBoxLine = this._PAPER.path(pathStr);
24333-
_bBoxLine.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX);
24345+
_bBoxLine.attr(bboxStyle);
2433424346
this._add(_bBoxLine, rElement.id + OG.Constants.GUIDE_SUFFIX.BBOX);
2433524347
_bBoxLine.insertBefore(rElement);
2433624348

@@ -24398,7 +24410,7 @@ OG.renderer.RaphaelRenderer.prototype.drawEdgeGuide = function (element) {
2439824410
}
2439924411
}
2440024412
_bBoxLine = this._PAPER.path(pathStr);
24401-
_bBoxLine.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX);
24413+
_bBoxLine.attr(bboxStyle);
2440224414

2440324415
// 시작지점 가이드
2440424416
_fromRect = this._PAPER.rect(vertices[0].x - _hSize, vertices[0].y - _hSize, _size, _size);
@@ -29058,7 +29070,10 @@ OG.handler.EventHandler.prototype = {
2905829070

2905929071
$(this).css({"position": "", "left": "", "top": ""});
2906029072
$.each(bBoxArray, function (k, item) {
29061-
renderer.setAttr(item.box, {transform: "t" + dx + "," + dy});
29073+
renderer.setAttr(item.box, {
29074+
transform: "t" + dx + "," + dy,
29075+
'stroke-width': 1
29076+
});
2906229077
});
2906329078

2906429079
setGroupTarget();

src/main/webapp/src/handler/EventHandler.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,10 @@ OG.handler.EventHandler.prototype = {
830830

831831
$(this).css({"position": "", "left": "", "top": ""});
832832
$.each(bBoxArray, function (k, item) {
833-
renderer.setAttr(item.box, {transform: "t" + dx + "," + dy});
833+
renderer.setAttr(item.box, {
834+
transform: "t" + dx + "," + dy,
835+
'stroke-width': 1
836+
});
834837
});
835838

836839
setGroupTarget();

src/main/webapp/src/renderer/RaphaelRenderer.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2962,7 +2962,6 @@ OG.renderer.RaphaelRenderer.prototype.drawDropOverGuide = function (element) {
29622962
};
29632963

29642964
OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
2965-
29662965
var me = this, rElement = this._getREleById(OG.Util.isElement(element) ? element.id : element),
29672966
geometry = rElement ? rElement.node.shape.geom : null,
29682967
envelope,
@@ -2976,6 +2975,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
29762975
_trash, isEdge, isEssensia, controllers = [], isLane,
29772976
_qUpper, _qLow, _qBisector, _qThirds;
29782977

2978+
var bboxStyle = element.shape.GUIDE_BBOX ? element.shape.GUIDE_BBOX : me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX;
29792979

29802980
var _isConnectable = rElement && me._CANVAS._HANDLER._isConnectable(element.shape);
29812981
var _isConnectCloneable = rElement && me._CANVAS._HANDLER._isConnectCloneable(element.shape);
@@ -3047,7 +3047,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
30473047
if (isEdge) {
30483048
_bBoxRect = me._PAPER.rect(_upperLeft.x - 10, _upperLeft.y - 10, envelope.getWidth() + 20, envelope.getHeight() + 20);
30493049
}
3050-
_bBoxRect.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX);
3050+
_bBoxRect.attr(bboxStyle);
30513051
me._add(_bBoxRect, rElement.id + OG.Constants.GUIDE_SUFFIX.BBOX);
30523052
guide.bBox = _bBoxRect.node;
30533053
}
@@ -3060,7 +3060,7 @@ OG.renderer.RaphaelRenderer.prototype.drawGuide = function (element) {
30603060
if (isEdge) {
30613061
_bBoxRect = me._PAPER.rect(_upperLeft.x - 10, _upperLeft.y - 10, envelope.getWidth() + 20, envelope.getHeight() + 20);
30623062
}
3063-
_bBoxRect.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX);
3063+
_bBoxRect.attr(bboxStyle);
30643064
me._add(_bBoxRect, rElement.id + OG.Constants.GUIDE_SUFFIX.BBOX);
30653065
}
30663066

@@ -3637,6 +3637,8 @@ OG.renderer.RaphaelRenderer.prototype.drawEdgeGuide = function (element) {
36373637
_size = me._CONFIG.GUIDE_RECT_SIZE, _hSize = OG.Util.round(_size / 2), _style = {},
36383638
i;
36393639

3640+
var bboxStyle = element.shape.GUIDE_BBOX ? element.shape.GUIDE_BBOX : me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX;
3641+
36403642
if (rElement && geometry) {
36413643
OG.Util.apply(_style, geometry.style.map, me._CONFIG.DEFAULT_STYLE.EDGE);
36423644

@@ -3670,7 +3672,7 @@ OG.renderer.RaphaelRenderer.prototype.drawEdgeGuide = function (element) {
36703672
}
36713673

36723674
_bBoxLine = this._PAPER.path(pathStr);
3673-
_bBoxLine.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX);
3675+
_bBoxLine.attr(bboxStyle);
36743676
this._add(_bBoxLine, rElement.id + OG.Constants.GUIDE_SUFFIX.BBOX);
36753677
_bBoxLine.insertBefore(rElement);
36763678

@@ -3738,7 +3740,7 @@ OG.renderer.RaphaelRenderer.prototype.drawEdgeGuide = function (element) {
37383740
}
37393741
}
37403742
_bBoxLine = this._PAPER.path(pathStr);
3741-
_bBoxLine.attr(me._CONFIG.DEFAULT_STYLE.GUIDE_BBOX);
3743+
_bBoxLine.attr(bboxStyle);
37423744

37433745
// 시작지점 가이드
37443746
_fromRect = this._PAPER.rect(vertices[0].x - _hSize, vertices[0].y - _hSize, _size, _size);

src/main/webapp/src/shape/component/DataTable.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,13 @@ OG.shape.component.DataTable = function () {
8989
shape.DELETABLE = false;
9090
shape.LABEL_EDITABLE = false;
9191
shape.RESIZABLE = false;
92-
shape.onSelectShape = function () {
93-
var me = this;
94-
me.currentCanvas.setShapeStyle(me.currentElement, {
95-
stroke: '#ff0100'
96-
})
97-
}
98-
shape.onDeSelectShape = function () {
99-
var me = this;
100-
me.currentCanvas.setShapeStyle(me.currentElement, {
101-
stroke: '#000'
102-
})
92+
shape.GUIDE_BBOX = {
93+
stroke: "#ff5b00",
94+
'stroke-width': 4,
95+
fill: "white",
96+
"fill-opacity": 0,
97+
"shape-rendering": "crispEdges",
98+
cursor: "move"
10399
}
104100
result.contents.push({
105101
/**
@@ -130,6 +126,8 @@ OG.shape.component.DataTable = function () {
130126

131127
//옵션데이터
132128
this.options = {
129+
selectable: 'column',
130+
133131
//mode: 'view',
134132
/**
135133
* 컨텐트 외부 드래그 가능 여부
@@ -1229,6 +1227,18 @@ OG.shape.component.DataTable.prototype.bindCellEvent = function () {
12291227

12301228
OG.shape.component.DataTable.prototype.createCellGuid = function (cellView) {
12311229
var me = this;
1230+
1231+
if(me.options.selectable == 'column'){
1232+
if(cellView.type != 'column'){
1233+
return;
1234+
}
1235+
}
1236+
if(me.options.selectable == 'cell'){
1237+
if(cellView.type != 'cell'){
1238+
return;
1239+
}
1240+
}
1241+
12321242
//기존 등록된 임시 셀을 모두 삭제토록.
12331243
var childs = me.currentCanvas.getChilds(me.currentElement);
12341244
for (var i = 0, leni = childs.length; i < leni; i++) {

0 commit comments

Comments
 (0)