Skip to content

A full-featured download manager.

fix: task detail activity graphic align center

Dr_rOot841bd8b92334
diff --git a/src/renderer/components/TaskDetail/TaskActivity.vue b/src/renderer/components/TaskDetail/TaskActivity.vue
index 91fdc5db..1dde0967 100644
--- a/src/renderer/components/TaskDetail/TaskActivity.vue
+++ b/src/renderer/components/TaskDetail/TaskActivity.vue
@@ -8,7 +8,7 @@
>
<div class="graphic-box" ref="graphicBox">
<mo-task-graphic
- :width="graphicWidth"
+ :outerWidth="graphicWidth"
:bitfield="task.bitfield"
v-if="graphicWidth > 0"
/>
@@ -190,7 +190,6 @@
if (!this.$refs.graphicBox) {
return
}
- console.log('updateGraphicWidth===>', this.$refs.graphicBox)
this.graphicWidth = this.calcInnerWidth(this.$refs.graphicBox)
},
calcInnerWidth (ele) {
@@ -199,8 +198,10 @@
}
const style = getComputedStyle(ele, null)
- const width = style.getPropertyValue('width')
- return parseInt(width, 10)
+ const width = parseInt(style.width, 10)
+ const paddingLeft = parseInt(style.paddingLeft, 10)
+ const paddingRight = parseInt(style.paddingRight, 10)
+ return width - paddingLeft - paddingRight
}
}
}
diff --git a/src/renderer/components/TaskGraphic/Index.vue b/src/renderer/components/TaskGraphic/Index.vue
index 52ff509d..74d164c1 100644
--- a/src/renderer/components/TaskGraphic/Index.vue
+++ b/src/renderer/components/TaskGraphic/Index.vue
@@ -33,7 +33,7 @@
type: String,
default: ''
},
- width: {
+ outerWidth: {
type: Number,
default: 240
},
@@ -65,8 +65,8 @@
return this.atomHeight + this.atomGutter
},
columnCount () {
- const { width, atomWidth, atomWG } = this
- const result = parseInt((width - atomWidth) / atomWG, 10) + 1
+ const { outerWidth, atomWidth, atomWG } = this
+ const result = parseInt((outerWidth - atomWidth) / atomWG, 10) + 1
return result
},
rowCount () {
@@ -75,9 +75,14 @@
return result
},
offset () {
- const { width, atomWidth, atomWG, columnCount } = this
+ const { outerWidth, atomWidth, atomWG, columnCount } = this
const totalWidth = atomWG * (columnCount - 1) + atomWidth
- const result = (width - totalWidth) / 2
+ const result = (outerWidth - totalWidth) / 2
+ return parseFloat(result.toFixed(2))
+ },
+ width () {
+ const { atomWidth, atomWG, columnCount } = this
+ const result = atomWG * (columnCount - 1) + atomWidth
return parseInt(result, 10)
},
height () {
@@ -116,7 +121,7 @@
const result = {
id: `${hIndex}`,
status: Math.floor(parseInt(bitfield[index], 16) / 4),
- x: offset + chIndex * atomWG,
+ x: chIndex * atomWG,
y: offset + rhIndex * atomHG
}
diff --git a/src/renderer/components/Theme/Default.scss b/src/renderer/components/Theme/Default.scss
index ccdc6600..d3e87a4d 100644
--- a/src/renderer/components/Theme/Default.scss
+++ b/src/renderer/components/Theme/Default.scss
@@ -266,13 +266,16 @@ iframe {
}
.graphic-box {
- padding: 0.5rem;
+ padding: 0.5rem 0.375rem;
margin-bottom: 1.5rem;
font-size: 0;
line-height: 0;
border: 1px solid $--task-detail-box-border;
border-radius: $--border-radius-base;
- box-sizing: content-box;
+ &> svg {
+ display: block;
+ margin: 0 auto;
+ }
}
.form-static-value {