提交 b17f7c1e 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!417 UI fix step trace bug that text covers others in svg

Merge pull request !417 from 黄伟锋/myMaster
...@@ -22,7 +22,6 @@ limitations under the License. ...@@ -22,7 +22,6 @@ limitations under the License.
:aria-expanded="suggestionVisible" :aria-expanded="suggestionVisible"
:aria-owns="id"> :aria-owns="id">
<el-input ref="input" <el-input ref="input"
class="rtl-item"
v-bind="[$props, $attrs]" v-bind="[$props, $attrs]"
@input="handleChange" @input="handleChange"
@focus="handleFocus" @focus="handleFocus"
......
...@@ -374,7 +374,7 @@ export default { ...@@ -374,7 +374,7 @@ export default {
totalTime: 0, totalTime: 0,
rowHeight: 60, rowHeight: 60,
markerPadding: 4, markerPadding: 4,
minRate: 0.05, minRate: 0.01,
namespaceURI: 'http://www.w3.org/2000/svg', namespaceURI: 'http://www.w3.org/2000/svg',
resizeTimer: null, resizeTimer: null,
colorList: [ colorList: [
...@@ -687,9 +687,17 @@ export default { ...@@ -687,9 +687,17 @@ export default {
const dashedLine = this.addDashedLine(index); const dashedLine = this.addDashedLine(index);
svg.insertBefore(dashedLine, svg.querySelector('g')); svg.insertBefore(dashedLine, svg.querySelector('g'));
let textOffsets = 0;
row.forEach((i) => { row.forEach((i) => {
if (i.duration) { if (i.duration) {
if (i.name) { if (i.name) {
if (i.duration < minTime) {
textOffsets++;
} else {
textOffsets = 0;
}
i.textOffsets = textOffsets;
const tempDom = this.createRect(i, index); const tempDom = this.createRect(i, index);
const tempStr = `g${ const tempStr = `g${
i.duration > minTime ? '' : '.arrow' i.duration > minTime ? '' : '.arrow'
...@@ -732,7 +740,6 @@ export default { ...@@ -732,7 +740,6 @@ export default {
const height = 40; const height = 40;
const width = (data.duration / this.svg.totalTime) * this.svg.totalWidth; const width = (data.duration / this.svg.totalTime) * this.svg.totalWidth;
const fontSize = 12; const fontSize = 12;
const normalRect = data.duration > this.svg.minRate * this.svg.totalTime;
const x1 = const x1 =
(data.start / this.svg.totalTime) * this.svg.totalWidth + (data.start / this.svg.totalTime) * this.svg.totalWidth +
...@@ -775,7 +782,7 @@ export default { ...@@ -775,7 +782,7 @@ export default {
foreignObject.setAttribute( foreignObject.setAttribute(
'x', 'x',
normalRect !data.textOffsets
? x1 ? x1
: Math.min( : Math.min(
this.svg.svgPadding * 2 + this.svg.totalWidth - textWidth, this.svg.svgPadding * 2 + this.svg.totalWidth - textWidth,
...@@ -785,14 +792,14 @@ export default { ...@@ -785,14 +792,14 @@ export default {
foreignObject.setAttribute( foreignObject.setAttribute(
'y', 'y',
y1 + (height - fontSize) / 2 + (normalRect ? 0 : fontSize), y1 + (height - fontSize) / 2 + data.textOffsets * fontSize,
); );
foreignObject.setAttribute('height', fontSize); foreignObject.setAttribute('height', fontSize);
foreignObject.setAttribute('width', width); foreignObject.setAttribute('width', width);
foreignObject.setAttribute('style', `color:${color[0]}`); foreignObject.setAttribute('style', `color:${color[0]}`);
foreignObject.setAttribute( foreignObject.setAttribute(
'class', 'class',
`content${normalRect ? '' : ' content-mini'}`, `content${!data.textOffsets ? '' : ' content-mini'}`,
); );
const title = document.createElementNS(this.svg.namespaceURI, 'title'); const title = document.createElementNS(this.svg.namespaceURI, 'title');
......
...@@ -164,7 +164,7 @@ export default { ...@@ -164,7 +164,7 @@ export default {
totalTime: 0, totalTime: 0,
rowHeight: 60, rowHeight: 60,
markerPadding: 4, markerPadding: 4,
minRate: 0.05, minRate: 0.01,
namespaceURI: 'http://www.w3.org/2000/svg', namespaceURI: 'http://www.w3.org/2000/svg',
resizeTimer: null, resizeTimer: null,
colorList: [ colorList: [
...@@ -483,9 +483,17 @@ export default { ...@@ -483,9 +483,17 @@ export default {
const dashedLine = this.addDashedLine(index); const dashedLine = this.addDashedLine(index);
svg.insertBefore(dashedLine, svg.querySelector('g')); svg.insertBefore(dashedLine, svg.querySelector('g'));
let textOffsets = 0;
row.forEach((i) => { row.forEach((i) => {
if (i.duration) { if (i.duration) {
if (i.name) { if (i.name) {
if (i.duration < minTime) {
textOffsets++;
} else {
textOffsets = 0;
}
i.textOffsets = textOffsets;
const tempDom = this.createRect(i, index); const tempDom = this.createRect(i, index);
const tempStr = `g${ const tempStr = `g${
i.duration > minTime ? '' : '.arrow' i.duration > minTime ? '' : '.arrow'
...@@ -528,7 +536,6 @@ export default { ...@@ -528,7 +536,6 @@ export default {
const height = 40; const height = 40;
const width = (data.duration / this.svg.totalTime) * this.svg.totalWidth; const width = (data.duration / this.svg.totalTime) * this.svg.totalWidth;
const fontSize = 12; const fontSize = 12;
const normalRect = data.duration > this.svg.minRate * this.svg.totalTime;
const x1 = const x1 =
(data.start / this.svg.totalTime) * this.svg.totalWidth + (data.start / this.svg.totalTime) * this.svg.totalWidth +
...@@ -571,7 +578,7 @@ export default { ...@@ -571,7 +578,7 @@ export default {
foreignObject.setAttribute( foreignObject.setAttribute(
'x', 'x',
normalRect !data.textOffsets
? x1 ? x1
: Math.min( : Math.min(
this.svg.svgPadding * 2 + this.svg.totalWidth - textWidth, this.svg.svgPadding * 2 + this.svg.totalWidth - textWidth,
...@@ -581,14 +588,14 @@ export default { ...@@ -581,14 +588,14 @@ export default {
foreignObject.setAttribute( foreignObject.setAttribute(
'y', 'y',
y1 + (height - fontSize) / 2 + (normalRect ? 0 : fontSize), y1 + (height - fontSize) / 2 + data.textOffsets * fontSize,
); );
foreignObject.setAttribute('height', fontSize); foreignObject.setAttribute('height', fontSize);
foreignObject.setAttribute('width', width); foreignObject.setAttribute('width', width);
foreignObject.setAttribute('style', `color:${color[0]}`); foreignObject.setAttribute('style', `color:${color[0]}`);
foreignObject.setAttribute( foreignObject.setAttribute(
'class', 'class',
`content${normalRect ? '' : ' content-mini'}`, `content${!data.textOffsets ? '' : ' content-mini'}`,
); );
const title = document.createElementNS(this.svg.namespaceURI, 'title'); const title = document.createElementNS(this.svg.namespaceURI, 'title');
...@@ -747,8 +754,8 @@ export default { ...@@ -747,8 +754,8 @@ export default {
} }
} }
.step-message { .step-message {
height: 24px; height: 32px;
line-height: 24px; line-height: 16px;
margin-top: 6px; margin-top: 6px;
margin-left: 14px; margin-left: 14px;
overflow-y: auto; overflow-y: auto;
...@@ -765,7 +772,7 @@ export default { ...@@ -765,7 +772,7 @@ export default {
font-weight: bold; font-weight: bold;
} }
.pf-content-middle { .pf-content-middle {
padding: 15px 15px 0; padding: 10px 15px 0;
height: calc(100% - 62px); height: calc(100% - 62px);
#trace-container { #trace-container {
width: 100%; width: 100%;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册