Is it possible to return the position and size of a object in jArchi as I've not been able to find a method on the Wiki. All you can do is specify position and size when creating, i.e. x, y, width, height.
There should be something like:
var object = selection.filter(selector)
console.log("object position is x: " + object.posx + " y:" + object.posy + ", size is width: " + object.width + " height:" + object.height)
OR return in JSON object
var objectProperties = selection.filter(selector)
objectProperties.x_position
objectPropeties.y_position
objectProperties.width
objectProperties.height
Returns:
{
x_position:<number>
y_position:<number>
width: <number>
height: <number>
}
If this is already possible then please can you show me, otherwise this would be really useful to add support - let me know if I should raise a feature issue.
If I understood properly your usecase, you could achieve it with:
//
// Get Coordinates
//
// Quick and dirty coordinates and graphical object dimensions, extraction
//
// # Main
// Clear the console for any new message which may occur
console.show();
console.clear();
// - for each selected objects,
selection.each(function(selectedElement) {
// - Print to the console their coordinates, width and height
console.log(selectedElement.name, ": ",selectedElement.bounds);
});
Going one step further would then be: selectedElement.bounds.x
, etc.
Perfecto :) :)
Exactly what I was after - having seen your code I re-read the wiki and found .bounds with description of 'Get/set the bounds...', but the snippet code only shows for setting object to bounds, hence why I missed it.
The Wiki guide can do with more detail and examples for all permutation of usage consistently stating the Getter and Setter variant and return value/object. I know this is open for all to edit and I'll try to work through, but have been hesitant as I don't want to mess it up. Phil/JB is there an edit->review process for the Wiki or are all edits issued and made public?
Btw - thank you projetnumero9
Quote from: Manj75 on August 23, 2021, 17:30:21 PM
The Wiki guide can do with more detail and examples for all permutation of usage consistently stating the Getter and Setter variant and return value/object. I know this is open for all to edit and I'll try to work through, but have been hesitant as I don't want to mess it up. Phil/JB is there an edit->review process for the Wiki or are all edits issued and made public?
Opening an issue on GH would work.
I've added a getter example of bounds to the wiki.