Skip to content

Commit

Permalink
Groups of shapes not always correctly loaded
Browse files Browse the repository at this point in the history
Groups of shapes not always correctly loaded
https://bugs.launchpad.net/latexdraw/+bug/1583121
  • Loading branch information
arnobl committed May 18, 2016
1 parent 3e5c6fa commit c2a60b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
4 changes: 3 additions & 1 deletion latexdraw-core/net.sf.latexdraw/release_note.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ Bugs fixed:
- Copy/paste a plotted shape does not work as expected
https://bugs.launchpad.net/latexdraw/+bug/1580483
- Boundaries of a group of shapes not correctly computed when moved outside the page
https://bugs.launchpad.net/latexdraw/+bug/1582559
https://bugs.launchpad.net/latexdraw/+bug/1582559
- Groups of shapes not always correctly loaded
https://bugs.launchpad.net/latexdraw/+bug/1583121
Original file line number Diff line number Diff line change
Expand Up @@ -723,21 +723,10 @@ protected Boolean doInBackground() throws Exception {
setProgress(0);

// Adding loaded shapes.
incrProgressBar = Math.max(50./(svgDoc.getDocumentElement().getChildNodes().getLength()+ui.getPresentations().size()), 1.);
final IShape shape = toLatexdraw(svgDoc, incrProgressBar);
incrProgressBar = Math.max(50./(svgDoc.getDocumentElement().getChildNodes().getLength()+ui.getPresentations().size()), 1.);

if(shape instanceof IGroup) { // If several shapes have been loaded
final IGroup group = (IGroup)shape;
final double incr = Math.max(50./group.size(), 1.);

for(final IShape sh : group.getShapes()) {
drawing.addShape(sh);
setProgress((int)Math.min(100., getProgress()+incr));
}
} else { // If only a single shape has been loaded.
drawing.addShape(shape);
setProgress(Math.min(100, getProgress()+50));
}
drawing.addShape(toLatexdraw(svgDoc, incrProgressBar));
setProgress(Math.min(100, getProgress()+50));

// Loads the presentation's data.
for(final Presentation<?,?> presentation : ui.getPresentations()) {
Expand Down

0 comments on commit c2a60b2

Please sign in to comment.