Skip to content
Snippets Groups Projects
Commit 49c07372 authored by Jonas Blatt's avatar Jonas Blatt :ant:
Browse files

Random place for input data

parent 4a6dbb4f
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,30 @@ function getSheetElementWithId(id) {
return getCurrentModeler()._sheet._elementRegistry.get(id);
}
/**
*
* @param sourceX
* @param sourceY
* @param w
* @param offsetX
* @param offsetY
* @returns {{x: *, y: *}}
*/
function getRandomNewPointInCycle(sourceX, sourceY, w, offsetX, offsetY) {
let dx = Math.floor(Math.random() * Math.floor(2 * w)) - w;
let dy = Math.sqrt(w * w - dx * dx);
if (offsetX) {
dx += offsetX;
}
if (offsetY) {
dy += offsetY;
}
if (Math.random() > 0.5) {
dy *= -1;
}
return {x: sourceX + dx, y: sourceY + dy};
}
/**
*
* @param {VerificationEntry} verificationEntry
......@@ -35,7 +59,7 @@ function performVerificationFix(verificationEntry, fix, id, $callerButton) {
break;
case 'CREATE':
performVerificationFixCREATE(verificationEntry, fix.actions[i]);
$callerButton.css('display', 'none');
//$callerButton.css('display', 'none');
break;
case 'DELETE':
performVerificationFixDELETE(verificationEntry, fix.actions[i]);
......@@ -208,7 +232,6 @@ function createRule(verificationEntry, fixAction) {
* @param {Action} fixAction
*/
function createInputData(verificationEntry, fixAction) {
// getCurrentModeler().createShape(getCurrentModeler()._elementFactory.createDrdElement('shape', {type:'dmn:InputData'}), {x:0,y:0}, dmnModeler._definitions)
openViewWithId(verificationEntry.elements[0].identifier['definitionId']);
let decision = getShapeWithId(
verificationEntry.elements[0].identifier['decisionId']);
......@@ -216,9 +239,11 @@ function createInputData(verificationEntry, fixAction) {
const shape = modeler._elementFactory.createDrdElement('shape',
{type: 'dmn:InputData'});
let inputData = modeler.appendShape(decision, shape,
{x: decision.x - 150, y: decision.y + 40},
getRandomNewPointInCycle(decision.x, decision.y, 250, decision.width / 2,
decision.height / 2),
getShapeWithId(verificationEntry.elements[0].identifier['definitionId']),
{attach: false, connection: {type: "dmn:InformationRequirement"}});
{attach: false, connection: {type: "dmn:InformationRequirement"}}
);
inputData.businessObject.name = fixAction.actionValues['name'];
openViewWithId(verificationEntry.elements[0].identifier['definitionId']);
}
......
......@@ -109,6 +109,10 @@ function toggleFullscreen() {
}
}
/**
*
* @param id
*/
function openViewWithId(id) {
var views = dmnModeler.getViews();
views.forEach(function (view) {
......@@ -135,12 +139,20 @@ function cleanHighlightFunction() {
renderHighlightFunction = [];
}
/**
*
* @param {Array<VerificationEntryElement>} elements
*/
function highlightMultipleDecisions(elements) {
elements.forEach(function (el) {
highlightSingleDecision(el.identifier['decisionId']);
});
}
/**
*
* @param decisionId
*/
function highlightSingleDecision(decisionId) {
// node
let $decisionNode = $(
......@@ -150,12 +162,20 @@ function highlightSingleDecision(decisionId) {
$('#tab-dec-' + decisionId).addClass('highlight');
}
/**
*
* @param {Array<VerificationEntryElement>} elements
*/
function cleanMultipleDecisions(elements) {
elements.forEach(function (el) {
cleanSingleDecision(el.identifier['decisionId']);
});
}
/**
*
* @param decisionId
*/
function cleanSingleDecision(decisionId) {
// node
let $decisionNode = $(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment