Skip to content

Instantly share code, notes, and snippets.

@xsrf
Created March 14, 2021 12:35
Show Gist options
  • Save xsrf/f7d10fd18c0be5cb1bb34ab7ef683716 to your computer and use it in GitHub Desktop.
Save xsrf/f7d10fd18c0be5cb1bb34ab7ef683716 to your computer and use it in GitHub Desktop.
EasyEDA Reset NetPort Mark alignment
// Reset NetPort Mark alignment (select Ports first)
api('getSelectedIds').split(',').forEach((k)=>{
netflag = api('getShape',{id: k});
if(netflag && netflag.mark && netflag.configure) {
netflag.mark.x = Number(netflag.configure.x) + (23 * (netflag.configure.rotation == 0 ? -1:1));
netflag.mark.y = Number(netflag.configure.y) + 3.5;
netflag.mark.textAnchor = (netflag.configure.rotation == 0) ? 'end' : 'start';
netflag.gId = netflag.configure.gId;
api('updateShape',{ shapeType:'netflag', "jsonCache": netflag });
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment