Skip to content

Commit

Permalink
feat: routing resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
ChangChiTW committed Feb 9, 2023
1 parent df2cdc7 commit 0d882bd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
23 changes: 22 additions & 1 deletion src/components/editor/common/SidebarMenu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
<span>grids</span>
</span>
</div>
<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"/>
<span>Higher resolution takes more time routing</span>
</span>
</div>
</div>
</template>

Expand All @@ -22,10 +30,16 @@ import { mapFields } from 'vuex-map-fields'
export default {
name: 'sidebar-menu',
data () {
return {
routingResolution: 0.2
}
},
computed: {
...mapFields([
'app.gridUnit',
'app.squareSize'
'app.squareSize',
'app.routingUnit'
]),
snappingDistance () {
return this.gridUnit.current / this.gridUnit.origin
Expand All @@ -34,6 +48,13 @@ export default {
methods: {
changeSnappingDistance (e) {
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
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/factories/stateFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function newState (height, width, gridUnit, cornerSize, gapSize, project) {
origin: gridUnit,
current: gridUnit
},
routingUnit: 4,
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: 4,
unit: 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: 4,
unit: 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: 4,
unit: state.app.routingUnit,
output_format: 'svg',
ewd_content: dataElectrode
}
Expand Down

0 comments on commit 0d882bd

Please sign in to comment.