feat:优化最小宽度选区
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
.inputarea {
|
.inputarea {
|
||||||
width: 1px;
|
width: 0;
|
||||||
height: 12px;
|
height: 12px;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
|||||||
@@ -375,7 +375,11 @@ export class Draw {
|
|||||||
// 选区绘制
|
// 选区绘制
|
||||||
const { startIndex, endIndex } = this.range.getRange()
|
const { startIndex, endIndex } = this.range.getRange()
|
||||||
if (startIndex !== endIndex && startIndex < index && index <= endIndex) {
|
if (startIndex !== endIndex && startIndex < index && index <= endIndex) {
|
||||||
this.range.render(ctx, x, y, metrics.width, curRow.height)
|
let width = metrics.width
|
||||||
|
if (width === 0 && curRow.elementList.length === 1) {
|
||||||
|
width = this.options.rangeMinWidth
|
||||||
|
}
|
||||||
|
this.range.render(ctx, x, y, width, curRow.height)
|
||||||
}
|
}
|
||||||
index++
|
index++
|
||||||
x += metrics.width
|
x += metrics.width
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export default class Editor {
|
|||||||
strikeoutColor: '#FF0000',
|
strikeoutColor: '#FF0000',
|
||||||
rangeAlpha: 0.6,
|
rangeAlpha: 0.6,
|
||||||
rangeColor: '#AECBFA',
|
rangeColor: '#AECBFA',
|
||||||
|
rangeMinWidth: 5,
|
||||||
searchMatchAlpha: 0.6,
|
searchMatchAlpha: 0.6,
|
||||||
searchMatchColor: '#FFFF00',
|
searchMatchColor: '#FFFF00',
|
||||||
highlightAlpha: 0.6,
|
highlightAlpha: 0.6,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export interface IEditorOption {
|
|||||||
strikeoutColor?: string;
|
strikeoutColor?: string;
|
||||||
rangeColor?: string;
|
rangeColor?: string;
|
||||||
rangeAlpha?: number;
|
rangeAlpha?: number;
|
||||||
|
rangeMinWidth?: number;
|
||||||
searchMatchColor?: string;
|
searchMatchColor?: string;
|
||||||
searchMatchAlpha?: number;
|
searchMatchAlpha?: number;
|
||||||
highlightAlpha?: number;
|
highlightAlpha?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user