Skip to content

Commit

Permalink
fix: routingUnit error
Browse files Browse the repository at this point in the history
  • Loading branch information
ChangChiTW committed Feb 22, 2023
1 parent bbef362 commit 3204011
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 33 deletions.
15 changes: 3 additions & 12 deletions src/components/editor/common/SidebarMenu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<div class="sidebar-content">
<p>Routing resolution:</p>
<span>
<input style="width: 65%;" type="range" id="res" name="res" min="0" max="1" step="0.01" :value="routingResolution" @change="changeRoutingResolution"/>
<input style="width: 25%;" type="number" min="0" max="1" step="0.01" :value="routingResolution" @change="changeRoutingResolution"/>
<input style="width: 65%;" type="range" id="res" name="res" min="0" max="1" step="0.01" :value="routingUnit" @change="changeRoutingResolution"/>
<input style="width: 25%;" type="number" min="0" max="1" step="0.01" :value="routingUnit" @change="changeRoutingResolution"/>
<span>Higher resolution takes more time routing</span>
</span>
</div>
Expand All @@ -30,11 +30,6 @@ import { mapFields } from 'vuex-map-fields'
export default {
name: 'sidebar-menu',
data () {
return {
routingResolution: 0.2
}
},
computed: {
...mapFields([
'app.gridUnit',
Expand All @@ -50,11 +45,7 @@ export default {
this.gridUnit.current = e.target.value * this.gridUnit.origin
},
changeRoutingResolution (e) {
this.routingResolution = e.target.value
this.routingUnit = this.gridUnit.origin / 100 * this.routingResolution
if (this.routingUnit === 0) {
this.routingUnit = 1
}
this.routingUnit = e.target.value
}
}
}
Expand Down
20 changes: 3 additions & 17 deletions src/components/editor/dialogs/RoutingResolutionDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<div class="confirm-dialog__content">
<p>Routing resolution:</p>
<span>
<input style="width: 72%;" type="range" id="res" name="res" min="0" max="1" step="0.01" :value="routingResolution" @change="changeRoutingResolution"/>
<input style="width: 18%;" type="number" min="0" max="1" step="0.01" :value="routingResolution" @change="changeRoutingResolution"/>
<input style="width: 72%;" type="range" id="res" name="res" min="0" max="1" step="0.01" :value="routingUnit" @change="changeRoutingResolution"/>
<input style="width: 18%;" type="number" min="0" max="1" step="0.01" :value="routingUnit" @change="changeRoutingResolution"/>
</span>
<p>Higher resolution takes more time routing.</p>
</div>
Expand All @@ -30,11 +30,6 @@ export default {
beforeDestroy: function () {
this.$root.$off('open-routing-resolution', this.openDialog)
},
data () {
return {
routingResolution: 0.2
}
},
computed: {
...mapFields([
'app.gridUnit',
Expand All @@ -46,22 +41,13 @@ export default {
},
methods: {
openDialog () {
if (this.routingUnit === 1) {
this.routingResolution = 0
} else {
this.routingResolution = this.routingUnit / this.gridUnit.origin * 100
}
if (!this.$el.showModal) {
dialogPolyfill.registerDialog(this.$el)
}
this.$el.showModal()
},
changeRoutingResolution (e) {
this.routingResolution = e.target.value
this.routingUnit = this.gridUnit.origin / 100 * this.routingResolution
if (this.routingUnit === 0) {
this.routingUnit = 1
}
this.routingUnit = e.target.value
},
onConfirm () {
if (!this.downloadProjectDXF()) {
Expand Down
2 changes: 1 addition & 1 deletion src/factories/stateFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function newState (height, width, gridUnit, cornerSize, gapSize, project) {
origin: gridUnit,
current: gridUnit
},
routingUnit: 4,
routingUnit: 0.2,
cornerSize: cornerSize,
gapSize: gapSize,
chip: {
Expand Down
6 changes: 3 additions & 3 deletions src/store/actions/projectAct.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const projectActions = {

const ewd = {
electrode_size: state.app.gridUnit.origin,
unit: state.app.routingUnit,
unit: state.app.routingUnit === 0 ? 1 : state.app.gridUnit.origin / 100 * state.app.routingUnit,
output_format: 'ecc_pattern',
ewd_content: dataElectrode
}
Expand Down Expand Up @@ -217,7 +217,7 @@ const projectActions = {

const ewd = {
electrode_size: state.app.gridUnit.origin,
unit: state.app.routingUnit,
unit: state.app.routingUnit === 0 ? 1 : state.app.gridUnit.origin / 100 * state.app.routingUnit,
output_format: 'dxf',
ewd_content: dataElectrode
}
Expand Down Expand Up @@ -248,7 +248,7 @@ const projectActions = {

const ewd = {
electrode_size: state.app.gridUnit.origin,
unit: state.app.routingUnit,
unit: state.app.routingUnit === 0 ? 1 : state.app.gridUnit.origin / 100 * state.app.routingUnit,
output_format: 'svg',
ewd_content: dataElectrode
}
Expand Down

0 comments on commit 3204011

Please sign in to comment.