Skip to content

Commit

Permalink
Merge branch 'main' into circuit-elements-panel-fix#285
Browse files Browse the repository at this point in the history
  • Loading branch information
itsHamdySalem authored Mar 24, 2024
2 parents 01b88ff + 0401925 commit a5affe9
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 117 deletions.
34 changes: 34 additions & 0 deletions src/components/DialogBox/HexBinDec.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,37 @@ function hexConverter(input: string) {
setBaseValues(x)
}
</script>

<style scoped>
#bitconverterprompt {
color: var(--text-lite);
}
#bitconverterprompt input {
color: var(--text-lite);
}
#bitconverterprompt label {
color: var(--text-lite) !important;
}
#bitconverterprompt {
text-align: center;
font: inherit;
border: none;
margin-top: 5px;
padding: 0;
}
#bitconverterprompt input {
background: transparent;
border: none;
outline: none;
text-align: center;
font: inherit;
}
#bitconverterprompt input:focus {
border: none;
}
</style>
133 changes: 53 additions & 80 deletions src/components/DialogBox/SaveImage.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<template>
<v-dialog
v-model="SimulatorState.dialogBox.saveimage_dialog"
:persistent="false"
>
<v-dialog v-model="dialogState.saveimage_dialog" :persistent="false">
<v-card class="messageBoxContent">
<v-card-text>
<p class="dialogHeader">Render Image</p>
<v-btn
size="x-small"
icon
class="dialogClose"
@click="SimulatorState.dialogBox.saveimage_dialog = false"
@click="dialogState.saveimage_dialog = false"
>
<v-icon>mdi-close</v-icon>
</v-btn>
Expand All @@ -25,96 +22,88 @@
type="radio"
name="imgType"
:value="imageType.toLowerCase()"
checked="checked"
@click="checkImgType"
v-model="selectedImageType"
@change="checkImgType(imageType)"
/>
{{ imageType }}
<span></span>
</label>
</div>
<div class="download-dialog-section-2">
<div
v-if="toShow == true"
v-if="toShow"
class="option inline btn-group btn-group-toggle"
style="border: none"
data-toggle="buttons"
>
<div
id="radio-full"
class="btn"
:class="
fullImg == true
? 'active-btn'
: 'inactive-btn'
"
:class="fullImg ? 'active-btn' : 'inactive-btn'"
role="button"
@click="updateView(1)"
@click="updateView(true)"
>
<input type="radio" name="view" value="full" />
Full Circuit View
</div>
<div
id="radio-current"
class="btn"
:class="
fullImg == false
? 'active-btn'
: 'inactive-btn'
"
:class="!fullImg ? 'active-btn' : 'inactive-btn'"
role="button"
@click="updateView(0)"
@click="updateView(false)"
>
<input
type="radio"
name="view"
value="current"
checked="checked"
/>Current View
</div>
</div>
<div
v-if="toShow1 == true"
class="download-dialog-section-2_2"
>
<div v-if="toShow1" class="download-dialog-section-2_2">
<label class="cb-checkbox">
<input
type="checkbox"
name="transparent"
value="transparent"
v-model="transparent"
/>
Transparent Background
</label>
</div>
</div>
<div
v-if="toShow == true"
class="download-dialog-section-3"
>
<div v-if="toShow" class="download-dialog-section-3">
<span>Resolution:</span>
<label class="option custom-radio inline"
><input
type="radio"
name="resolution"
value="1"
checked="checked" />1x<span></span

v-model="resolution"
/>1x<span></span
></label>
<label class="option custom-radio inline"
><input
type="radio"
name="resolution"
value="2" />2x<span></span
value="2"
v-model="resolution"
/>2x<span></span
></label>
<label class="option custom-radio inline"
><input
type="radio"
name="resolution"
value="4" />4x<span></span
value="4"
v-model="resolution"
/>4x<span></span
></label>
</div>
</div>
</v-card-text>
<v-card-actions>
<v-btn class="messageBtn" block @click="renderCircuit()">
<v-btn class="messageBtn" block @click="renderCircuit">
Render Circuit Image
</v-btn>
</v-card-actions>
Expand All @@ -125,60 +114,44 @@
<script lang="ts" setup>
import { generateImage } from '#/simulator/src/data/save'
import { useState } from '#/store/SimulatorStore/state'
import { onMounted, ref } from '@vue/runtime-core'
import { ref, computed, Ref } from '@vue/runtime-core'
const SimulatorState = useState()
const imgTypeList = ref([''])
imgTypeList.value = ['PNG', 'JPEG', 'SVG', 'BMP', 'GIF', 'TIFF']
const toShow = ref(true)
const toShow1 = ref(true)
const fullImg = ref(false)
const dialogState = computed(() => SimulatorState.dialogBox)
onMounted(() => {
SimulatorState.dialogBox.saveimage_dialog = false
})
const imgTypeList: Ref<string[]> = ref(['PNG', 'JPEG', 'SVG', 'BMP', 'GIF', 'TIFF'])
const toShow: Ref<boolean> = ref(true)
const toShow1: Ref<boolean> = ref(true)
const fullImg: Ref<boolean> = ref(false)
const resolution: Ref<number> = ref(1)
const transparent: Ref<boolean> = ref(false)
const selectedImageType: Ref<string> = ref('png')
function renderCircuit() {
SimulatorState.dialogBox.saveimage_dialog = false
generateImage(
$('input[name=imgType]:checked').val(),
$('input[name=view]:checked').val(),
$('input[name=transparent]:checked').val(),
$('input[name=resolution]:checked').val()
)
}
function checkImgType(imageType: string) {
const isDisabled = imageType.toLowerCase() === 'svg'
toShow.value = !isDisabled
toShow1.value = imageType.toLowerCase() === 'png'
function checkImgType() {
$('input[name=resolution]').prop('disabled', false)
$('input[name=transparent]').prop('disabled', false)
const imgType = $('input[name=imgType]:checked').val()
imgType == 'svg' ? (toShow.value = false) : (toShow.value = true)
if (imgType === 'png') {
toShow1.value = true
} else {
toShow1.value = false
}
if (imgType === 'svg') {
$('input[name=resolution][value=1]').trigger('click')
$('input[name=view][value="full"]').trigger('click')
$('input[name=resolution]').prop('disabled', true)
$('input[name=view]').prop('disabled', true)
} else if (imgType !== 'png') {
$('input[name=transparent]').attr('checked', false)
$('input[name=transparent]').prop('disabled', true)
$('input[name=view]').prop('disabled', false)
$('.cb-inner').addClass('disable')
} else {
$('input[name=view]').prop('disabled', false)
$('.cb-inner').removeClass('disable')
if (isDisabled) {
resolution.value = 1
fullImg.value = true
} else if (imageType.toLowerCase() !== 'png') {
transparent.value = false
}
}
function updateView(x) {
if (x == 1) {
fullImg.value = true
} else {
fullImg.value = false
}
function updateView(isFullImg: boolean) {
fullImg.value = isFullImg
}
function renderCircuit() {
SimulatorState.dialogBox.saveimage_dialog = false
generateImage(
selectedImageType.value,
fullImg.value ? 'full' : 'current',
transparent.value,
resolution.value
)
}
</script>
17 changes: 0 additions & 17 deletions src/styles/color_theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -494,23 +494,6 @@ select {
background: var(--disable);
}

#bitconverterprompt {
color: var(--text-lite);
}

#bitconverterprompt input {
/* border-bottom: 1px solid var(--br-primary); */
color: var(--text-lite);
}

#bitconverterprompt input:focus {
/* border-bottom: 1px solid var(--br-primary); */
}

#bitconverterprompt label {
color: var(--text-lite) !important;
}

.radio-green {
background: #42b983;
}
Expand Down
20 changes: 0 additions & 20 deletions src/styles/css/main.stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -1534,26 +1534,6 @@ input:checked + .slider:before {
left: 0;
}

#bitconverterprompt {
text-align: center;
font: inherit;
border: none;
margin-top: 5px;
padding: 0;
}

#bitconverterprompt input {
background: transparent;
border: none;
outline: none;
text-align: center;
font: inherit;
}

#bitconverterprompt input:focus {
border: none;
}

.ui-dialog .ui-dialog-buttonpane button {
margin-left: 0.4em;
}
Expand Down

0 comments on commit a5affe9

Please sign in to comment.