Skip to content

Commit

Permalink
Merge pull request #595 from lixinghua123/LLMM-lxh
Browse files Browse the repository at this point in the history
feat: Rect tool supports one-key setting invalid / feat: LLMMultiWheel tool label supports maximum display characters
  • Loading branch information
lihqi authored Dec 2, 2024
2 parents 6b75591 + 79fabd8 commit cfc2c9e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
12 changes: 6 additions & 6 deletions packages/lb-annotation/src/core/toolOperation/rectOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -995,11 +995,8 @@ class RectOperation extends BasicToolOperation {
this.clearActiveStatus();
}

public setRectValidAndRender(id: string) {
if (!id) {
return;
}

public setRectValidAndRender(id?: string) {
const hasValid = this.rectList.some((rect) => rect?.valid);
this.setRectList(
this.rectList.map((rect) => {
if (rect.id === id) {
Expand All @@ -1008,6 +1005,9 @@ class RectOperation extends BasicToolOperation {
valid: !rect.valid,
};
}
if (this.selection.isIdSelected(rect.id)) {
rect.valid = !hasValid;
}
return rect;
}),
true,
Expand Down Expand Up @@ -1385,7 +1385,7 @@ class RectOperation extends BasicToolOperation {
break;

case EKeyCode.F:
if (this.selectedRectID) {
if (this.selectedIDs.length > 0) {
this.setRectValidAndRender(this.selectedRectID);
}

Expand Down
26 changes: 25 additions & 1 deletion packages/lb-components/src/components/longText/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface IProps {
openByText?: boolean; // hover文字展开
style?: CSSProperties;
isToolTips?: boolean;
wordCount?: number;
maxWordCount?: number;
overflowMaxLines?: number;
}

Expand Down Expand Up @@ -75,6 +75,7 @@ const LongText = (props: IProps) => {
style,
isToolTips,
overflowMaxLines = 1,
maxWordCount,
} = props;

const el = useRef<null | HTMLDivElement>(null);
Expand All @@ -87,6 +88,29 @@ const LongText = (props: IProps) => {
return el.current && el.current?.clientWidth < el.current?.scrollWidth;
}, [size]);

if (maxWordCount) {
if (text.length > maxWordCount) {
const newText = text.substring(0, maxWordCount) + '...';
const tipsProps = {
placement,
content: text,
};
if (isToolTips) {
return (
<Tooltip {...tipsProps} title={text}>
<TextDom overflowMaxLines={overflowMaxLines} style={style} ref={el} text={newText} />
</Tooltip>
);
}
return (
<Popover {...tipsProps}>
<TextDom overflowMaxLines={overflowMaxLines} style={style} ref={el} text={newText} />
</Popover>
);
}
return <span>{text}</span>;
}

if (openByText) {
let tipsProps = {
placement,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

.tagItem {
display: flex;
max-width: 60px;
}

.disabled {
Expand Down
4 changes: 2 additions & 2 deletions packages/lb-components/src/components/tagList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const CheckBoxList = ({ tagItem, selectedTags, handleChange, disabeledAll }: ICh
})}
>
<span className={styles.tagItem}>
<LongText text={tag?.key} openByText={true} />
<LongText text={tag?.key} openByText={true} maxWordCount={10} />
</span>
</CheckableTag>
))}
Expand All @@ -72,7 +72,7 @@ const CheckBoxList = ({ tagItem, selectedTags, handleChange, disabeledAll }: ICh
{subSelected.map((tag) => (
<Radio value={tag?.value} key={tag?.value} disabled={disabled}>
<span className={styles.tagItem}>
<LongText text={tag?.key} openByText={true} />
<LongText text={tag?.key} openByText={true} maxWordCount={10} />
</span>
</Radio>
))}
Expand Down

0 comments on commit cfc2c9e

Please sign in to comment.