Skip to content

Instantly share code, notes, and snippets.

@jbsarrodie
Created March 2, 2020 15:52
Show Gist options
  • Save jbsarrodie/9784e2035d0e6599a8a7a890ba8c63cd to your computer and use it in GitHub Desktop.
Save jbsarrodie/9784e2035d0e6599a8a7a890ba8c63cd to your computer and use it in GitHub Desktop.
#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