Skip to content
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

Paper.js API Breaking Changes #52

Closed
dephora opened this issue Jun 21, 2017 · 4 comments
Closed

Paper.js API Breaking Changes #52

dephora opened this issue Jun 21, 2017 · 4 comments

Comments

@dephora
Copy link

dephora commented Jun 21, 2017

First, great library.

In the interest of keeping it in line with newer versions of Paper.js I'll document breaking changes if there is a desire to upgrade (or for those who want to use the more recent versions of Paper.js). This will be a running list as I haven't yet tested everything.

Currently testing on Paper 0.11.4 / OpenSeadragon 2.2.1

Undo breaks immediately.

function applyUndo(undo) {
    if( undo.imageNumber !== currentImage )
        setImage(undo.imageNumber);
    var info = ImageInfo[undo.imageNumber]["Regions"];
    while( info.length > 0 )
        removeRegion(info[0], undo.imageNumber);
    region = null;
    for( var i = 0; i < undo.regions.length; i++ ) {
        var el = undo.regions[i];
		var project = paper.projects[ImageInfo[undo.imageNumber]["projectID"]];
		/* Create the path and add it to a specific project.
		 */
		var path = new paper.Path();
/*1106*/	project.addChild(path);   // <====== Breaking ======>
		path.importJSON(el.json);
		reg = newRegion({name:el.name, path:path}, undo.imageNumber);
        // here order matters. if fully selected is set after selected, partially selected paths will be incorrect
  		reg.path.fullySelected = el.fullySelected;
 		reg.path.selected = el.selected;
		if( el.selected ) {
			if( region === null )
				region = reg;
			else
				console.log("Should not happen: two regions selected?");
		}
    }
    drawingPolygonFlag = undo.drawingPolygonFlag;
}
// line 1106
project.addChild(path);
Paper.js

https://github.com/paperjs/paper.js/blob/develop/CHANGELOG.md (V 0.10.0)
Undocumented function Project#addChild() that added a layer to a project. It is replaced by Project#addLayer() and Project#insertLayer().

r03ert0 added a commit that referenced this issue Oct 10, 2017
@r03ert0
Copy link
Owner

r03ert0 commented Oct 10, 2017

Hi @dephora! Thank you for the bug report! Thanks to the link you provided the bug was very easy to fix : ) (in the branch update-paperjs). I'll check if there are some other bugs and merge with the node-express branch (which moves away from mysql/php into mongo/express)

@r03ert0 r03ert0 closed this as completed Oct 10, 2017
@r03ert0
Copy link
Owner

r03ert0 commented Oct 10, 2017

update to paperjs 2.3.1 breaks 'addPoint' function

@r03ert0 r03ert0 reopened this Oct 10, 2017
@r03ert0
Copy link
Owner

r03ert0 commented Oct 10, 2017

I was able to track the problem in the addPoint function to a bug in paperjs, reported as issue #1392 (paperjs/paper.js#1392)

@r03ert0
Copy link
Owner

r03ert0 commented Oct 11, 2017

Commit 084955b adds a workaround this issue: the insert function is kept in a temporary variable, and injected back to path after importJSON was invoked.

@r03ert0 r03ert0 closed this as completed Oct 11, 2017
ntraut added a commit to ntraut/microdraw that referenced this issue Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants