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

Feature add auto flip layers #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion auto-generated-widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -1658,17 +1658,22 @@

mirrorX: false,
mirrorY: false,
userModifiedMirrors: false,
//V5.1D20161229 - Added
setupMirrorAxis: function() {
this.userModifiedMirrors = false;
$("#com-chilipeppr-widget-eagle .mirrorAxisX").change(this.onChangeMirrorAxis.bind(this));
$("#com-chilipeppr-widget-eagle .mirrorAxisY").change(this.onChangeMirrorAxis.bind(this));
$('#com-chilipeppr-widget-eagle .mirrorAxisX').prop ("checked", false);
$('#com-chilipeppr-widget-eagle .mirrorAxisY').prop ("checked", false);
},
//V5.1D20161229 - Added
onChangeMirrorAxis: function() {
onChangeMirrorAxis: function(e,wasCode) {
this.mirrorX = $('#com-chilipeppr-widget-eagle .mirrorAxisX').prop ("checked");
this.mirrorY = $('#com-chilipeppr-widget-eagle .mirrorAxisY').prop ("checked");
if (!wasCode) {
this.userModifiedMirrors = true;
}
//this.clearEagleBrd();
//this.draw3d();
},
Expand Down Expand Up @@ -1778,6 +1783,24 @@
}*/
var oldActiveLayer = this.activeLayer;
if (selectedLayerInDropdown != oldActiveLayer) {
if (selectedLayerInDropdown == "Bottom") {
var hasMirror = this.mirrorX || this.mirrorY;
if (!hasMirror && !this.userModifiedMirrors) {
var mirrY$ = $('#com-chilipeppr-widget-eagle .mirrorAxisY');
mirrY$.prop("checked", true);
mirrY$.trigger("change", true); //Send it wasn't user that dirtied the controls
}
}
if (selectedLayerInDropdown == "Top") {
var hasMirror = this.mirrorX || this.mirrorY;
if (hasMirror && !this.userModifiedMirrors) {
var mirrY$ = $('#com-chilipeppr-widget-eagle .mirrorAxisY');
var mirrX$ = $('#com-chilipeppr-widget-eagle .mirrorAxisX');
mirrY$.prop("checked", false);
mirrX$.prop("checked", false);
mirrY$.trigger("change", true); //Send it wasn't user that dirtied the controls
}
}
this.activeLayer = selectedLayerInDropdown;
console.log("layer active now: ", this.activeLayer);
//debugger;
Expand Down Expand Up @@ -2290,6 +2313,7 @@
chilipeppr.publish("/com-chilipeppr-elem-flashmsg/flashmsg", "Opening Eagle BRD", "Parsing Eagle BRD file and generating signal paths.", 3000, true);
// reset main properties
this.activeLayer = 'Top';
this.userModifiedMirrors = false;
this.clearEagleBrd();
this.clear3dViewer();
// create board
Expand Down