modified zoom

This commit is contained in:
girish
2011-02-19 12:26:12 +00:00
parent 42e284000e
commit cce75f6df8
4 changed files with 103 additions and 91 deletions

View File

@@ -66,8 +66,8 @@ bpmnAnnotation.prototype.paint = function () {
this.graphics.drawLine(this.getWidth()/4,0,0,0);
this.graphics.drawLine(0,0,0,this.getHeight());
this.graphics.drawLine(0,this.getHeight(),this.getWidth()/4,this.getHeight());
this.graphics.setStroke(Stroke.DOTTED);
this.graphics.drawLine(0,this.getHeight()/2,-this.getWidth()/2,-this.getHeight()/4);
//this.graphics.setStroke(Stroke.DOTTED);
//this.graphics.drawLine(0,this.getHeight()/2,-this.getWidth()/2,-this.getHeight()/4);
this.graphics.paint();
/* New object is created to implement changing of Text functionality

View File

@@ -374,8 +374,7 @@ MyWorkflow.prototype.toggleShapes=function(item)
{
for(var j = 0; j < conn[i].data.length ; j++)
{
if(typeof conn[i].data[j] != 'undefined')
{
if(typeof conn[i].data[j] != 'undefined') {
sourceNode[countConn] = conn[i].data[j].sourcePort.parentNode;
targetNode[countConn] = conn[i].data[j].targetPort.parentNode;
sourcePortName[countConn] = conn[i].data[j].sourcePort.properties.name;
@@ -477,15 +476,13 @@ MyWorkflow.prototype.swapTaskSubprocess=function(itemObj)
newShape = eval("new "+itemObj.type+"(this.workflow)");
//Swapping from Task to subprocess and vice -versa
if((newShape.type == 'bpmnSubProcess' || newShape.type == 'bpmnTask') && !itemObj.type.match(/Boundary/))
{
if((newShape.type == 'bpmnSubProcess' || newShape.type == 'bpmnTask') && !itemObj.type.match(/Boundary/)) {
newShape.actiontype = 'addSubProcess';
if(newShape.type == 'bpmnTask')
newShape.actiontype = 'addTask';
newShape.workflow.saveShape(newShape);
}
if((this.type == 'bpmnTask' || this.type == 'bpmnSubProcess') && !itemObj.type.match(/Boundary/) )
{
if((this.type == 'bpmnTask' || this.type == 'bpmnSubProcess') && !itemObj.type.match(/Boundary/)) {
this.actiontype = 'deleteTask';
this.noAlert = true;
if(this.type == 'bpmnSubProcess')
@@ -525,8 +522,7 @@ MyWorkflow.prototype.checkConnectionsExist=function(port,portType,portTypeName)
if(typeof conn[i] != 'undefined')
for(var j = 0; j < conn[i].data.length ; j++)
{
if(typeof conn[i].data[j] != 'undefined')
{
if(typeof conn[i].data[j] != 'undefined') {
portParentId[countConn] = eval('conn[i].data[j].'+portType+'.parentNode.id');
portName[countConn] = eval('conn[i].data[j].'+portType+'.properties.name');
countConn++;
@@ -800,7 +796,8 @@ MyWorkflow.prototype.enablePorts=function(oShape,aPort)
/*Setting Background ,border and Z-order of the flow menu back to original when clicked
*on the shape
**/
for(var i=0; i< aPort.length ; i++){
for(var i=0; i< aPort.length ; i++)
{
if(aPort[i].match(/input/))
eval('oShape.workflow.currentSelection.'+aPort[i]+'.setBackgroundColor(new Color(245, 115, 115))');
else
@@ -822,7 +819,8 @@ MyWorkflow.prototype.disableFlowMenu =function(oShape,aPort)
/*Setting Background ,border and Z-order of the flow menu back to original when clicked
*on the shape
*/
for(var i=0; i< aPort.length ; i++){
for(var i=0; i< aPort.length ; i++)
{
if(aPort[i].match(/input/))
eval('oShape.workflow.currentSelection.'+aPort[i]+'.setBackgroundColor(new Color(245, 115, 115))');
else
@@ -921,10 +919,8 @@ MyWorkflow.prototype.getCommonConnections = function(oShape)
var tester = oShape.workflow.commonPorts.data;
var temp1 = eval("oShape.workflow.commonPorts.data["+j+"].getConnections()");
if(temp1.data[0]) {
if(routes[j])
{
if(routes[j][1] != temp1.data[0].sourcePort.parentNode.id)
{
if(routes[j]) {
if(routes[j][1] != temp1.data[0].sourcePort.parentNode.id) {
routes[j] = new Array(3);
routes[j][0] = temp1.data[0].id;
routes[j][1] = temp1.data[0].sourcePort.parentNode.id;
@@ -933,8 +929,7 @@ MyWorkflow.prototype.getCommonConnections = function(oShape)
routes[j][4] = temp1.data[0].sourcePort.properties.name;
}
}
else
{
else {
routes[j] = new Array(3);
routes[j][0] = temp1.data[0].id;
routes[j][1] = temp1.data[0].sourcePort.parentNode.id;
@@ -943,12 +938,6 @@ MyWorkflow.prototype.getCommonConnections = function(oShape)
routes[j][4] = temp1.data[0].sourcePort.properties.name;
}
}
//j++;
// while(routes[j])
// {
// j++
// };
// j--;
}
var j = 0;
var serial = new Array();
@@ -1171,24 +1160,20 @@ MyWorkflow.prototype.saveShape= function(oNewShape)
MyWorkflow.prototype.saveTask= function(actiontype,xpos,ypos)
{
if(actiontype != '')
{
if(actiontype != '') {
var pro_uid = this.getUrlVars();
var actiontype = actiontype;
var pos = '{"x":'+xpos+',"y":'+ypos+'}';
switch(actiontype)
{
switch(actiontype) {
case 'addTask':
urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","position":'+pos+'}';
break;
}
Ext.Ajax.request({
url: "processes_Ajax.php"+ urlparams,
success: function(response) {
//Ext.Msg.alert (response.responseText);
if(response.responseText != 1 && response.responseText != "")
{
if(response.responseText != 1 && response.responseText != "") {
workflow.newTaskInfo = Ext.util.JSON.decode(response.responseText);
workflow.taskName = this.workflow.newTaskInfo.label;
workflow.task = eval("new bpmnTask(workflow) ");
@@ -1868,6 +1853,12 @@ MyWorkflow.prototype.zoom = function(sType)
var xPos = fig.orgXPos * sType;
var yPos = fig.orgYPos * sType;
if(fig.type == 'bpmnTask'){
if (fig.getWidth() > 200 || this.getHeight() > 100) {
fig.limitFlag = false;
}
if (this.getWidth() < 165 || this.getHeight() < 40) {
fig.limitFlag = false;
}
fig.fontSize = parseInt(fig.orgFontSize) * sType;
//fig.bpmnText.drawStringRect(fig.taskName, fig.padleft, fig.padtop, fig.rectWidth, fig.rectheight, 'center');
fig.bpmnText.paint();

View File

@@ -6,12 +6,12 @@ bpmnTask = function (oWorkflow) {
}
//Getting width and height from DB
if(typeof oWorkflow.task_width != 'undefined' && typeof oWorkflow.task_height != 'undefined' && oWorkflow.task_width != ''){
this.width = oWorkflow.task_width;
this.height = oWorkflow.task_height
this.originalWidth = oWorkflow.task_width;
this.originalHeight = oWorkflow.task_height
}
else{
this.width = 165;
this.height = 40;
this.originalWidth = 165;
this.originalHeight = 40;
}
this.taskName = ''; //It will set the Default Task Name with appropriate count While dragging a task on the canvas
@@ -44,22 +44,39 @@ bpmnTask.prototype.coord_converter = function (bound_width, bound_height, text_l
bpmnTask.prototype.paint = function () {
VectorFigure.prototype.paint.call(this);
if(typeof workflow.zoomfactor == 'undefined')
if(typeof workflow.zoomfactor == 'undefined') {
this.originalWidth = 165;
this.originalHeight = 40;
workflow.zoomfactor = 1;
}
if(workflow.zoomfactor == 1) {
if ((this.getWidth() > 200 || this.getHeight() > 100) && this.limitFlag != true) {
this.width = this.originalWidth = 200;
this.height = this.originalHeight = 100;
}
if ((this.getWidth() < 165 || this.getHeight() < 40) && this.limitFlag != true) {
this.width = this.originalWidth = 165;
this.height = this.originalHeight = 40;
}
}
else{
this.width = this.originalWidth * workflow.zoomfactor;
this.height = this.originalHeight * workflow.zoomfactor;
}
//For Zooming
//Set the Task Limitation
if ((this.getWidth() >= 200 || this.getHeight() >= 100 ) && this.limitFlag != true) {
/*if ((this.getWidth() >= 200 || this.getHeight() >= 100 ) && this.limitFlag != true) {
this.originalWidth = 200;
this.originalHeight = 100;
}
else if ((this.getWidth() <= 165 || this.getHeight() <= 40) && this.limitFlag != true) {
this.originalWidth = 165;
this.originalHeight = 40;
}
}*/
this.width = this.originalWidth * workflow.zoomfactor;
this.height = this.originalHeight * workflow.zoomfactor;
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);
@@ -682,6 +699,7 @@ FlowMenu.prototype.onOtherFigureMoved = function (_39fd) {
else if (bpmnShape.match(/End/)) {
this.removechild(this.actionInterEvent);
this.removechild(this.actionEndEvent);
this.removechild(this.actionAnnotation);
this.removechild(this.actionTask);
this.removechild(this.actionGateway);
this.removechild(this.actionAdd);
@@ -703,6 +721,7 @@ FlowMenu.prototype.onOtherFigureMoved = function (_39fd) {
}
else if (bpmnShape.match(/Annotation/) || bpmnShape.match(/Dataobject/)) {
this.removechild(this.actionAdd);
this.removechild(this.actionAnnotation);
this.removechild(this.actionInterEvent);
this.removechild(this.actionGateway);
this.removechild(this.actionEndEvent);
@@ -792,6 +811,7 @@ bpmnTask.prototype.addShapes = function (oStore) {
else if (newShape.type.match(/Annotation/)) {
conn.setTarget(newShape.getPort("input1"));
conn.setSource(workflow.currentSelection.getPort("output2"));
//conn.targetDecorator.setStroke(Stroke.DOTTED);
workflow.addFigure(conn);
newShape.actiontype = 'addText';
newShape.conn = conn;

View File

@@ -859,6 +859,7 @@ Ext.onReady ( function() {
NewShape = eval("new "+data.name+"(workflow)");
NewShape.x = e.xy[0];
NewShape.y = e.xy[1];
NewShape.limitFlag == false;
NewShape.actiontype = 'addTask';
if(data.name == 'bpmnAnnotation'){
NewShape.actiontype = 'addText';