Skip to content

Commit

Permalink
keep default on layer change
Browse files Browse the repository at this point in the history
  • Loading branch information
xsrf committed Apr 7, 2021
1 parent 63d130e commit 2531700
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions extension/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const extensionId = 'extension-toggleview-id'.split('-')[1]; // this format is needed to set the Extension ID during install
const manifest = easyeda.extension.instances[extensionId].manifest;
const instance = easyeda.extension.instances[extensionId];
var defaultFlipped = false;


/*
Expand Down Expand Up @@ -179,7 +180,7 @@ const initObserver = () => {

const layerChanged = () => {
layerId = getActiveLayerId();
setFlipped(isAutoToggleOnLayer(layerId));
setFlipped(defaultFlipped || isAutoToggleOnLayer(layerId));
}

const setAutoToggleOnLayer = (layerId,checked) => {
Expand Down Expand Up @@ -224,7 +225,8 @@ const getFlipped = () => {
}

const toggle = () => {
setFlipped(!getFlipped());
defaultFlipped = !getFlipped();
setFlipped(defaultFlipped);
}

const getActiveLayerId = () => {
Expand Down

0 comments on commit 2531700

Please # to comment.