Improved Zoom Function

This commit is contained in:
girish
2011-02-07 09:33:12 +00:00
parent bbe73c53c6
commit 1fe4ffa5f8
14 changed files with 107 additions and 150 deletions

View File

@@ -48,11 +48,11 @@ bpmnAnnotation.prototype.paint = function () {
VectorFigure.prototype.paint.call(this);
//Set the Task Limitation
if(this.getWidth() > 200 || this.getHeight() > 100)
if((this.getWidth() > 200 || this.getHeight() > 100 ) && this.limitFlag != true)
{
this.setDimension(200, 100);
}
if(this.getWidth() < 110 || this.getHeight() < 60)
if((this.getWidth() < 110 || this.getHeight() < 60 ) && this.limitFlag != true)
{
this.setDimension(110, 60);
}

View File

@@ -11,7 +11,7 @@ bpmnEventEmptyEnd.prototype=new VectorFigure;
bpmnEventEmptyEnd.prototype.type="bpmnEventEmptyEnd";
bpmnEventEmptyEnd.prototype.paint=function(){
VectorFigure.prototype.paint.call(this);
if (this.getWidth() < 30 || this.getHeight() < 30) {
if ((this.getWidth() < 30 || this.getHeight() < 30) && this.limitFlag != true) {
this.setDimension(30, 30);
}
var x=0;

View File

@@ -11,7 +11,7 @@ bpmnEventEmptyInter.prototype=new VectorFigure;
bpmnEventEmptyInter.prototype.type="bpmnEventEmptyInter";
bpmnEventEmptyInter.prototype.paint=function(){
VectorFigure.prototype.paint.call(this);
if (this.getWidth() < 30 || this.getHeight() < 30) {
if ((this.getWidth() < 30 || this.getHeight() < 30) && this.limitFlag != true) {
this.setDimension(30, 30);
}
this.graphics.setStroke(this.stroke);

View File

@@ -11,7 +11,7 @@ bpmnEventEmptyStart.prototype=new VectorFigure;
bpmnEventEmptyStart.prototype.type="bpmnEventEmptyStart";
bpmnEventEmptyStart.prototype.paint=function(){
VectorFigure.prototype.paint.call(this);
if (this.getWidth() < 30 || this.getHeight() < 30) {
if ((this.getWidth() < 30 || this.getHeight() < 30 ) && this.limitFlag != true) {
this.setDimension(30, 30);
}
@@ -27,20 +27,12 @@ this.graphics.setColor("#4aa533");
this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight());
this.graphics.paint();
/*Code Added to Dynamically shift Ports on resizing of shapes
**/
if(this.input1!=null){
this.input1.setPosition(0,this.height/2);
}
if(this.output1!=null){
this.output1.setPosition(this.width/2,this.height);
}
if(this.input2!=null){
this.input2.setPosition(this.width/2,0);
}
if(this.output2!=null){
this.output2.setPosition(this.width,this.height/2);
}

View File

@@ -43,6 +43,19 @@ this.graphics.drawLine(this.getWidth()/2,this.getHeight()/1.3,this.getWidth()/2,
this.graphics.drawLine(this.getWidth()/1.5,this.getHeight()/1.5,this.getWidth()/3,this.getHeight()/3); //cross line
this.graphics.paint();
if (this.input1 != null) {
this.input1.setPosition(0, this.height / 2);
}
if (this.input2 != null) {
this.input2.setPosition(this.width / 2, 0);
}
if (this.output1 != null) {
this.output1.setPosition(this.height / 2, this.width);
}
if (this.output2 != null) {
this.output2.setPosition(this.width, this.height / 2);
}
};
bpmnGatewayComplex.prototype.setWorkflow=function(_40c5){

View File

@@ -35,6 +35,18 @@ var y_cross=new Array(this.getHeight()/1.3,this.getHeight()/1.7,this.getHeight()
this.graphics.setColor( "#a27628" );
this.graphics.fillPolygon(x_cross,y_cross);
this.graphics.paint();
if (this.input1 != null) {
this.input1.setPosition(0, this.height / 2);
}
if (this.input2 != null) {
this.input2.setPosition(this.width / 2, 0);
}
if (this.output1 != null) {
this.output1.setPosition(this.height / 2, this.width);
}
if (this.output2 != null) {
this.output2.setPosition(this.width, this.height / 2);
}
};

View File

@@ -44,6 +44,18 @@ this.graphics.setColor("#a27628");
this.graphics.drawPolygon(x_penta,y_penta);
this.graphics.setColor("#a27628");
this.graphics.paint();
if (this.input1 != null) {
this.input1.setPosition(0, this.height / 2);
}
if (this.input2 != null) {
this.input2.setPosition(this.width / 2, 0);
}
if (this.output1 != null) {
this.output1.setPosition(this.height / 2, this.width);
}
if (this.output2 != null) {
this.output2.setPosition(this.width, this.height / 2);
}
};
bpmnGatewayExclusiveEvent.prototype.setWorkflow=function(_40c5){

View File

@@ -38,6 +38,18 @@ this.graphics.fillEllipse(this.getWidth()/4,this.getHeight()/4,this.getWidth()/2
this.graphics.setColor("#a27628");
this.graphics.drawEllipse(this.getWidth()/4,this.getHeight()/4,this.getWidth()/2,this.getHeight()/2);
this.graphics.paint();
if (this.input1 != null) {
this.input1.setPosition(0, this.height / 2);
}
if (this.input2 != null) {
this.input2.setPosition(this.width / 2, 0);
}
if (this.output1 != null) {
this.output1.setPosition(this.height / 2, this.width);
}
if (this.output2 != null) {
this.output2.setPosition(this.width, this.height / 2);
}
};
bpmnGatewayInclusive.prototype.setWorkflow=function(_40c5){

View File

@@ -37,6 +37,19 @@ this.graphics.fillPolygon(x,y);
this.graphics.setColor("#a27628");
this.graphics.drawPolygon(x,y);
this.graphics.paint();
if (this.input1 != null) {
this.input1.setPosition(0, this.height / 2);
}
if (this.input2 != null) {
this.input2.setPosition(this.width / 2, 0);
}
if (this.output1 != null) {
this.output1.setPosition(this.height / 2, this.width);
}
if (this.output2 != null) {
this.output2.setPosition(this.width, this.height / 2);
}
};
bpmnGatewayParallel.prototype.setWorkflow=function(_40c5){

View File

@@ -1759,88 +1759,6 @@ MyWorkflow.prototype.getDeleteCriteria = function()
* @Param sType string(in/out)
* @Author Girish joshi
*/
//MyWorkflow.prototype.zoom = function(sType)
//{
// //workflow.zoomFactor = 1;
// var figures = workflow.getDocument().getFigures();
//
// var lines=workflow.getLines();
// var size=lines.getSize();
//
// if(typeof workflow.limitFlag == 'undefined')
// workflow.limitFlag = 0;
//
// var zoomFactor = 0.2;
// var figSize = figures.getSize();
// for(f = 0;f<figures.getSize();f++){
// var fig = figures.get(f);
// var width = fig.getWidth();
// var height = fig.getHeight();
// var xPos = fig.getX();
// var yPos = fig.getY();
//
// if(sType == 'in')
// {
// if(fig.type.match(/Event/) || fig.type.match(/Gateway/))
// {
// width += zoomFactor*25;
// height += zoomFactor*25;
// workflow.zoomWidth = width;
// workflow.zoomHeight = height;
// }
// else if(fig.type.match(/Annotation/)) {
// width += zoomFactor*50;
// height += zoomFactor*50;
// workflow.zoomAnnotationWidth = width;
// workflow.zoomAnnotationHeight = height;
// }
// else
// {
// width += zoomFactor*50;
// height += zoomFactor*50;
// workflow.zoomTaskWidth = width;
// workflow.zoomTaskHeight = height;
// }
// ++workflow.limitFlag;
// xPos = xPos + zoomFactor*xPos;
// yPos = yPos + zoomFactor*yPos
// fig.setPosition(xPos,yPos);
// }
// else if(sType == 'out' && workflow.limitFlag > 0)
// {
// if(fig.type.match(/Event/) || fig.type.match(/Gateway/) )
// {
// width -= zoomFactor*25;
// height -= zoomFactor*25;
// workflow.zoomWidth = width;
// workflow.zoomHeight = height;
// }
// else if(fig.type.match(/Annotation/)) {
// width -= zoomFactor*50;
// height -= zoomFactor*50;
// workflow.zoomAnnotationWidth = width;
// workflow.zoomAnnotationHeight = height;
// }
// else
// {
// width -= zoomFactor*50;
// height -= zoomFactor*50;
// workflow.zoomTaskWidth = width;
// workflow.zoomTaskHeight = height;
// }
// --workflow.limitFlag;
// xPos = xPos - zoomFactor*xPos;
// yPos = yPos - zoomFactor*yPos
// fig.setPosition(xPos,yPos);
// }
// fig.setDimension(width,height);
// if(fig.type == 'bpmnTask')
// workflow.redrawTaskText(fig,sType);
// else if(fig.type == 'bpmnAnnotation')
// workflow.redrawAnnotationText(fig,sType);
// }
//}
MyWorkflow.prototype.zoom = function(sType)
{
//workflow.zoomFactor = 1;
@@ -1848,64 +1766,41 @@ MyWorkflow.prototype.zoom = function(sType)
var lines=workflow.getLines();
var size=lines.getSize();
sType =sType/100;
//var zoomFactor = 0.2;
var figSize = figures.getSize();
for(f = 0;f<figures.getSize();f++){
var fig = figures.get(f);
// var width = fig.getWidth();
// var height = fig.getHeight();
// var xPos = fig.getX();
// var yPos = fig.getY();
if(typeof workflow.limitFlag == 'undefined')
if(typeof fig.limitFlag == 'undefined')
{
fig.originalWidth = fig.getWidth();
fig.originalHeight = fig.getHeight();
fig.orgXPos = fig.getX();
fig.orgYPos = fig.getY();
fig.orgFontSize =fig.fontSize;
fig.limitFlag = true;
}
if(fig.type.match(/Event/) || fig.type.match(/Gateway/))
{
width = fig.originalWidth*sType;
height = fig.originalHeight*sType;
workflow.zoomWidth = width;
workflow.zoomHeight = height;
}
else if(fig.type.match(/Annotation/)) {
width = fig.originalWidth*sType;
height = fig.originalHeight*sType;
workflow.zoomAnnotationWidth = width;
workflow.zoomAnnotationHeight = height;
}
else
{
width = fig.originalWidth*sType;
height = fig.originalHeight*sType;
workflow.zoomTaskWidth = width;
workflow.zoomTaskHeight = height;
}
xPos = fig.orgXPos * sType;
yPos = fig.orgYPos * sType;
var width = fig.originalWidth*sType;
var height = fig.originalHeight*sType;
var xPos = fig.orgXPos * sType;
var yPos = fig.orgYPos * sType;
fig.setPosition(xPos,yPos);
fig.setDimension(width,height);
if(fig.type == 'bpmnTask')
fig.setPosition(xPos,yPos);
fig.setDimension(width,height);
if(fig.type == 'bpmnTask')
{
fig.fontSize = parseInt(fig.orgFontSize) * sType;
fig.paint();
}
else if(fig.type == 'bpmnAnnotation')
else if(fig.type == 'bpmnAnnotation')
{
fig.fontSize = parseInt(fig.orgFontSize) * sType;
fig.paint();
}
}
workflow.limitFlag = 1;
}
}
MyWorkflow.prototype.redrawTaskText = function(fig,sType)

View File

@@ -83,8 +83,8 @@ ProcessOptions.prototype.addDynaform= function(_5625)
DYN_UID : dynUID
},
success: function(response) {
PMExt.notify( _('ID_MY_LABEL_WITH_ANY_TITLE') , _('ID_MY_MSG') );
//Ext.MessageBox.alert ('Status','Dynaform has been removed successfully.');
//PMExt.notify( _('ID_TITLE_JS') , _('ID_TITLE') );
Ext.MessageBox.alert ('Status','Dynaform has been removed successfully.');
//Secondly deleting from Grid
taskDynaform.remove(r);
//Reloading store after deleting dynaform
@@ -94,12 +94,14 @@ ProcessOptions.prototype.addDynaform= function(_5625)
}
else
PMExt.warning(_('ID_STATUS'), _('ID_CONFIRM_CANCEL_CASE'));
Ext.MessageBox.alert ('Status','Dynaform assigned to a process supervisors cannot be deleted.');
PMExt.notify( _('ID_TITLE_JS') , _('ID_TITLE') );
// Ext.MessageBox.alert ('Status','Dynaform assigned to a process supervisors cannot be deleted.');
}
});
}
else
Ext.MessageBox.alert ('Status','Dynaform assigned to a task steps cannot be deleted.');
PMExt.notify( _('ID_TITLE_JS') , _('ID_TITLE_JS') );
//Ext.MessageBox.alert ('Status','Dynaform assigned to a task steps cannot be deleted.');
}
});
}

View File

@@ -103,6 +103,19 @@ bpmnSubProcess.prototype.paint = function () {
this.bpmnNewText = bpmnText;
if (this.input1 != null) {
this.input1.setPosition(0, this.height / 2);
}
if (this.output1 != null) {
this.output1.setPosition(this.width / 2, this.height);
}
if (this.input2 != null) {
this.input2.setPosition(this.width / 2, 0);
}
if (this.output2 != null) {
this.output2.setPosition(this.width, this.height / 2);
}
};
jsGraphics.prototype.drawTextString = function (txt, x, y, dx, dy) {

View File

@@ -44,12 +44,12 @@ bpmnTask.prototype.paint = function () {
VectorFigure.prototype.paint.call(this);
//Set the Task Limitation
// if (this.getWidth() > 200 || this.getHeight() > 100) {
// this.setDimension(200, 100);
// }
// else if (this.getWidth() < 165 || this.getHeight() < 40) {
// this.setDimension(165, 40);
// }
if ((this.getWidth() > 200 || this.getHeight() > 100 ) && this.limitFlag != true) {
this.setDimension(200, 100);
}
else if ((this.getWidth() < 165 || this.getHeight() < 40) && this.limitFlag != true) {
this.setDimension(165, 40);
}
var x = new Array(6, this.getWidth() - 3, this.getWidth(), this.getWidth(), this.getWidth() - 3, 6, 3, 3, 6);
var y = new Array(3, 3, 6, this.getHeight() - 3, this.getHeight(), this.getHeight(), this.getHeight() - 3, 6, 3);

View File

@@ -262,14 +262,7 @@ Ext.onReady ( function() {
}
]
})
}, {
// text:'Zoom Out',
// iconCls: 'button_menu_ext ss_sprite ss_zoom_out',
// handler: function() {
// document.getElementById('designerFrame').contentWindow.workflow.zoom('out');
// }
}, {
},{
text:'Edit Process',
iconCls: 'button_menu_ext ss_sprite ss_pencil',
handler: function() {