Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#jArchi script to resize visual objects in the selected view
// Resize objects in selected view
//
// Requires jArchi - https://www.archimatetool.com/blog/2018/07/02/jarchi/
//
// This script resizes visual objects in the selected view
//
// (c) 2020 Jean-Baptiste Sarrodie
var factor = window.prompt("Resize factor for objects?", 2);
if (!factor) {
exit();
}
var textFactor = window.prompt("Resize factor for text?", factor);
if (!textFactor) {
exit();
}
var view = selection.filter("archimate-diagram-model").first();
$(view).children().not("relationship").each(function(o) {
resizeObjectAndItsChildren(o);
});
function resizeObjectAndItsChildren(obj) {
var bounds = obj.bounds;
bounds.x *= factor;
bounds.y *= factor;
bounds.width *= factor;
bounds.height *= factor;
obj.bounds = bounds;
obj.fontSize *= textFactor;
$(obj).children().each(function(o) {resizeObjectAndItsChildren(o)});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment