-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resizing of group element is unavailable #4
Comments
How would that work? A group gets its dimensions from its children. You can't give a group a height or width. So you cant resize it. |
I don't know why this happens but the case of a group of lines,It moves its position instead of resizing sometimes and sometimes nothing happens with no error. |
I say it again only for you: groups are not resizeable. As I said: Use nested SVGs which gives you a better chance to do what you want |
I've already understood that a group is not resizable and is hardly possible to implement it due to a technical reason by first your comment.
Anyway,I really appreciate that you explain in a concise and easy-to-understand manner. |
My bad. I should just stop to write in such a harsh way. Sorry. For now using nested svg doenst work. |
Nice plugin. I have the same issue while resizing a group of nested elements. Is it impossible to do it? |
As I stated above: You cant resize a group. It has no dimensions. |
Fuzzyma, I really appreciate your work, but I found working example of resizing group using bebox and matrix. It working even on ie11 <?xml version="1.0" encoding="UTF-8" ?>
<svg version="1.2" viewBox="0 0 480 240" width="480" height="240" xmlns="http://www.w3.org/2000/svg" >
<g id="g1">
<rect x="20" y="20" width="100" height="100" fill="red" />
<rect x="40" y="60" width="100" height="100" fill="blue" />
</g>
<script type="application/ecmascript">
var width=70, height=70;
var node = document.getElementById("g1");
var bb = node.getBBox();
var matrix = "matrix("+width / bb.width+", 0, 0, "+height / bb.height+", 0,0)";
node.setAttribute("transform", matrix);
</script>
</svg> |
That's correct you could resize everything when you scale it. But this plugin does not scale the whole shape. It changes the coordinates. That's a big difference. However having said this scaling would be obviously a possibility to have resizingfor everything. I might look into that again. Thanks for the heads-up! |
Fuzzyma thank you for our quick answer. After changing 2 lines in your code Right handler properly works on group. Of course it will be a little more to change :) // Right
case 'r':
// s.a.
this.calc = function (diffX, diffY) {
var snap = this.snapToGrid(diffX, diffY, 0);
if (this.parameters.box.width + snap[0] > 0) {
if (this.parameters.type === "text") {
return;
}
this.el.move(this.parameters.box.x, this.parameters.box.y)
// original width setting
//.width(this.parameters.box.width + snap[0]);
// new width settting
var matrix = "matrix("+(this.parameters.box.width + snap[0]) / this.parameters.box.width+", 0, 0, 1, 0,0)";
this.el.node.setAttribute("transform", matrix);
}
};
break; |
I guess it will work once and then it fails pulling the correct width of the group. Because bbox is used there and bbox gives back the untransformed with :). However with current 2.5 and rbox this problem would go away |
Rbox * zoom shuld do the trick as you said :) Fuzzyma. We using your tools very intensively. Is there any roadmap for new version of resize.js? btw nobody on the net hasn't done resize library based on svg group yet (at last as far as I search) |
This project was on ice for quite some time. However when I see it's used and needed I am happy to continue working on it. Fast Roadmap:
However for the next week or so I will have no time for working on this. Currently working on the svgdom project so people can use svg.js on their node server |
Fuzzyma thank you :). We will look forward for info! |
+1, strongly need resize of group element. Or nested SVG. |
+1 on resize of group elements.
also the resize should allow to resize a group that may contains other groups Willing to donate if reasonable. |
There is a problem when resizing elements via scale. Its not only the dimension which changes. No - everything scales accordingly. So child elements also scale, so does the text and most importingly the stroke width. |
I would personally be happy as much if the plug-ins functionality was done using nested SVG if that would make things possible. |
no actually that wouldnt change a thing. sorry |
Yes. Stroke width is a problem. But You can always do a separate tool for text resizing only. The common problem in resizing is that you have image and placeholder.. or few combined images. Image and a frame. If you want to catch all tails at once :) you need to resize each object one by one, with different rules |
The current svg.resize.js already handles this nicely for a "single" element selected without the stroke issue (when I currently resize a circle or path or rectangle, the stroke remains the same). Each element may have a property attached (may be an idea could be a specific class name added to the element with "addClass") that may instruct the svg.resize routines whether to skip resize / rotation / skew etc.. to each shape / text. *** edit *** By the way, here is someone that is suggesting how to avoid the stroke issue.. Sorry you even lost time reading the stupid suggestion :-( For my issue, I just have to do a custom solution for my specific case.... Thank you. |
https://jsfiddle.net/RafaelSantosFerraz/5nvjjc1r/18/ I manage to create a JQuery simple example for resizing a svg group of elements using scale. Its draggable to.
Hope it can help someone and maybe get implemented to svg.js. |
so far I checked,this library is not supporting group element.
is there any way to use this library for group element?
The text was updated successfully, but these errors were encountered: