Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix some issues #387

Merged
merged 2 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/pages/Console/OutputBox/index.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
position: relative;
border-top: 1px solid #E0E0E0;
flex: 1;
white-space: pre;
.outputTab {
min-height: 300px;
max-height: 720px;
Expand Down
8 changes: 6 additions & 2 deletions app/pages/Console/OutputBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ const OutputBox = (props: IProps) => {
onResultConfig!(data);
}
};

const handleRemoveMenu = () => {
graph.setPointer({
showContextMenu: false,
});
};
const parseToGraph = () => {
const { vertexes, edges } = parseSubGraph(data.tables, spaceVidType);
onExplorer!({
Expand Down Expand Up @@ -320,7 +324,7 @@ const OutputBox = (props: IProps) => {
/>
</div>
{resultSuccess && data.timeCost !== undefined && (
<div className={styles.outputFooter}>
<div className={styles.outputFooter} onClick={handleRemoveMenu}>
<span>
{`${intl.get('console.execTime')} ${data.timeCost /
1000000} (s)`}
Expand Down
2 changes: 1 addition & 1 deletion app/pages/Console/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const Console = (props: IProps) => {
<CypherParameterBox onSelect={addParam} data={paramsMap} />
<CodeMirror
value={currentGQL}
onBlur={value => update({ currentGQL: value })}
onChange={value => update({ currentGQL: value })}
ref={editor}
height={isUpDown ? '120px' : 24 * maxLineNum + 'px'}
onShiftEnter={handleRun}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ const SchemaVisualization = () => {
style: LINE_STYLE,
arrowStyle: ARROW_STYLE,
properties: line.properties,
textBackgroundColor: '#fff'
};
}).filter(line => line.from && line.to);
makeLineSort(_lines);
Expand Down
30 changes: 17 additions & 13 deletions app/pages/SketchModeling/Plugins/SketchShapes/Path.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const Path: LineRender = {
return path;
},
renderLabel(line: InstanceLine): SVGGElement {
const { name, invalid } = line.data as ISketchEdge;
const { name, invalid, textBackgroundColor } = line.data as ISketchEdge;
if (!name) {
if (line.label) {
line.label.labelGroup.remove();
Expand All @@ -165,25 +165,29 @@ const Path: LineRender = {
// to append to last
line.shape?.appendChild(line.label.labelGroup);

let string = name;
const showNum = 20;
const totalLen = line.pathData.getTotalLength();
const pointLen = line.pathData.getPointAtLength(totalLen / 2);
// eslint-disable-next-line prefer-const
let { x, y } = pointLen || {};
if (name && name.length > showNum && showNum) {
string = name.slice(0, showNum) + '...';
}

if(string || invalid) {
const width = string ? Math.min(string?.length * 10 + 15, 100) : 15;
const fromPoint = line.bezierData ? line.bezierData.from : line.from;
const toPoint = line.bezierData ? line.bezierData.to : line.to;
const angle = Math.atan((fromPoint.y - toPoint.y) / (fromPoint.x - toPoint.x)) * 180 / Math.PI;
if(name || invalid) {
const width = totalLen ? totalLen * 0.4 : 15;
ReactDOM.render(
<>
<foreignObject x={x - width / 2} y={y - 20} width={width} height={45} textAnchor="middle">
<foreignObject x={x - width / 2} y={y - 10}
width={width} height={20}
textAnchor="middle" transform-origin={`${x} ${y}`}
style={{ transform: `rotate(${angle}deg)` }}>
<div className={styles.edgeLabel}>
<span>
{string}
{invalid && <span className={styles.invalid} />}
<span style={{ paddingRight: invalid ? '10px' : undefined, maxWidth: width, backgroundColor: (textBackgroundColor) as string }}>
{name}
{invalid && <span className={styles.invalid} style={ !name ? {
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)'
} : undefined} />}
</span>
</div>
</foreignObject>
Expand Down
23 changes: 10 additions & 13 deletions app/pages/SketchModeling/Plugins/SketchShapes/index.module.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import '~@app/common.less';
@shadowBlue: rgba(0, 194, 255, 0.6) !important;
@pathBlue: rgba(0, 145, 255, 0.7);
.labelContainer {
Expand All @@ -10,12 +11,8 @@
text-align: center;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
max-width: 70%;
word-break: break-all;
font-size: 14px;
font-size: 12px;
user-select: none;
}
}
Expand All @@ -28,21 +25,18 @@
justify-content: center;
align-items: center;
max-height: 100%;
font-size: 12px;
height: 100%;
>span {
max-width: 80px;
height: 100%;
padding-right: 15px;
position: relative;
overflow: hidden;
text-overflow: ellipsis;
min-height: 10px;
display: -webkit-box;
white-space: pre-wrap;
word-break: break-word;
white-space: nowrap;
user-select: none;
line-height: 12px;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
padding: 0 3px;
background-color: @lightWhite;
}
.invalid {
width: 10px;
Expand Down Expand Up @@ -77,6 +71,9 @@
:global(.ve-line.active), :global(.ve-line:hover) {
.edgeLabel {
color: #0091FF;
span {
background-color: @lightWhite;
}
}

.arrow {
Expand Down