Created
December 9, 2020 20:21
-
-
Save projetnumero9/3301cfb99d8747c79a8bd6e0edcec32e to your computer and use it in GitHub Desktop.
#jArchi Create createViewReference between concept and view, back and forth, to ease navigation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Link concept to View | |
// | |
// 2020 David GERARD | |
// | |
// For selected concept in view, search the model for a view with the same name. | |
// If found, | |
// - create a .createViewReference() positioned in the upperleft corner of the concept, pointing to the view with the same name | |
// - create a .createViewReference() positioned in the upperleft corner of the view with the same name, point to the view holding the selected concept | |
// Quite useful to describe process and subprocesses, and especially with the HTML export | |
// | |
// No nesting for the time being; follow [Extend .createViewReference with 'autoNest' optional boolean parameter · Issue #81 · archimatetool/archi-scripting-plugin](https://github.com/archimatetool/archi-scripting-plugin/issues/81) | |
// | |
// Roadmap: | |
// - currently the script should not be run multiple times for the same concept: it will create multiple .createViewReference(), stacked | |
// | |
// # Functions | |
// # Variables | |
var list = $(selection); | |
all_views = $("archimate-diagram-model"); | |
// # Main | |
console.show(); | |
console.clear(); | |
console.log("> Link concept to View:"); | |
list.each(function(theConcept) { | |
currentConceptView = $("."+theConcept.view.name).filter("archimate-diagram-model").first() ; | |
if ($("."+theConcept.name).filter("archimate-diagram-model").first()!= null) { | |
var targetView = $("."+theConcept.name).filter("archimate-diagram-model").first() ; | |
viewRef = currentConceptView.createViewReference(targetView, theConcept.bounds.x, theConcept.bounds.y, 30, 30); | |
viewRef = targetView.createViewReference(currentConceptView, 10, 10, 30, 30); | |
}; | |
}); | |
console.log("> Ending properly"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment