使得动态输入框可以被鼠标选择,被键盘全选.

pull/106/MERGE
ChenX 6 years ago
parent a8600439f2
commit 3c424d528b

@ -44,6 +44,9 @@ export class DynamicInput
this.isShiftDown = false;
});
this.inputEl.addEventListener("change", () => { this.Lock = true; });
this.inputEl.addEventListener("mousedown", e => { e.stopPropagation() });
this.inputEl.addEventListener("selectstart", e => { e.stopPropagation(); })
this.inputEl.style.border = "3px solid transparent";
this.container.appendChild(this.inputEl);
container.appendChild(this.container);
@ -88,16 +91,10 @@ export class DynamicInput
case KeyBoard.Comma:
e.preventDefault();
return;
case KeyBoard.Alt:
case KeyBoard.Control:
e.preventDefault();
e.stopPropagation();
return;
//shift + 2 =>@ 切换成相对模式
case KeyBoard.Shift:
this.isShiftDown = true;
e.stopPropagation();
break;
case KeyBoard.Digit2:
if (this.isShiftDown)
@ -105,18 +102,17 @@ export class DynamicInput
e.preventDefault();
this.OnToggleRelativeEvent();
}
e.stopPropagation();
break;
default:
e.stopPropagation();
break;
}
e.stopPropagation();
setTimeout(() =>
{
if (this.inputEl.selectionEnd - this.inputEl.selectionStart === 0)
{
DynamicInputManage.GetManage().IsInputing = true;
this.inputEl.style.pointerEvents = "";
}
}, 16);
}
@ -137,6 +133,7 @@ export class DynamicInput
public Blur()
{
this.inputEl.disabled = true;
this.inputEl.style.pointerEvents = "none";
this.inputEl.style.backgroundColor = '#999';
DynamicInputManage.GetManage().IsInputing = false;

Loading…
Cancel
Save