Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
49b27148
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
49b27148
编写于
3月 08, 2017
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update mouse pointer style while DND
上级
2cca80e5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
56 addition
and
9 deletion
+56
-9
src/vs/editor/browser/config/configuration.ts
src/vs/editor/browser/config/configuration.ts
+6
-1
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+2
-2
src/vs/editor/common/config/defaultConfig.ts
src/vs/editor/common/config/defaultConfig.ts
+1
-0
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+6
-0
src/vs/editor/contrib/dnd/browser/dnd.css
src/vs/editor/contrib/dnd/browser/dnd.css
+7
-0
src/vs/editor/contrib/dnd/browser/dnd.ts
src/vs/editor/contrib/dnd/browser/dnd.ts
+29
-1
src/vs/editor/contrib/dnd/common/dragAndDropCommand.ts
src/vs/editor/contrib/dnd/common/dragAndDropCommand.ts
+5
-5
未找到文件。
src/vs/editor/browser/config/configuration.ts
浏览文件 @
49b27148
...
...
@@ -337,7 +337,7 @@ export class Configuration extends CommonEditorConfiguration {
super
.
dispose
();
}
protected
_getEditorClassName
(
theme
:
string
,
fontLigatures
:
boolean
):
string
{
protected
_getEditorClassName
(
theme
:
string
,
fontLigatures
:
boolean
,
mouseStyle
:
'
text
'
|
'
default
'
|
'
copy
'
):
string
{
let
extra
=
''
;
if
(
browser
.
isIE
)
{
extra
+=
'
ie
'
;
...
...
@@ -352,6 +352,11 @@ export class Configuration extends CommonEditorConfiguration {
if
(
fontLigatures
)
{
extra
+=
'
enable-ligatures
'
;
}
if
(
mouseStyle
===
'
default
'
)
{
extra
+=
'
mouse-default
'
;
}
else
if
(
mouseStyle
===
'
copy
'
)
{
extra
+=
'
mouse-copy
'
;
}
return
'
monaco-editor
'
+
extra
+
theme
;
}
...
...
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
49b27148
...
...
@@ -536,7 +536,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
private
_computeInternalOptions
():
editorCommon
.
InternalEditorOptions
{
let
opts
=
this
.
_configWithDefaults
.
getEditorOptions
();
let
editorClassName
=
this
.
_getEditorClassName
(
opts
.
theme
,
toBoolean
(
opts
.
fontLigatures
));
let
editorClassName
=
this
.
_getEditorClassName
(
opts
.
theme
,
toBoolean
(
opts
.
fontLigatures
)
,
opts
.
mouseStyle
);
let
disableTranslate3d
=
toBoolean
(
opts
.
disableTranslate3d
);
let
canUseTranslate3d
=
this
.
_getCanUseTranslate3d
();
...
...
@@ -587,7 +587,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
return
r
?
r
:
1
;
}
protected
abstract
_getEditorClassName
(
theme
:
string
,
fontLigatures
:
boolean
):
string
;
protected
abstract
_getEditorClassName
(
theme
:
string
,
fontLigatures
:
boolean
,
mouseDrag
:
'
text
'
|
'
default
'
|
'
copy
'
):
string
;
protected
abstract
getOuterWidth
():
number
;
...
...
src/vs/editor/common/config/defaultConfig.ts
浏览文件 @
49b27148
...
...
@@ -67,6 +67,7 @@ class ConfigClass implements IConfiguration {
cursorBlinking
:
'
blink
'
,
mouseWheelZoom
:
false
,
cursorStyle
:
'
line
'
,
mouseStyle
:
'
text
'
,
fontLigatures
:
false
,
disableTranslate3d
:
false
,
disableMonospaceOptimizations
:
false
,
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
49b27148
...
...
@@ -309,6 +309,12 @@ export interface IEditorOptions {
* Defaults to false.
*/
mouseWheelZoom
?:
boolean
;
/**
* Control the mouse pointer style, either 'text' or 'default' or 'copy'
* Defaults to 'text'
* @internal
*/
mouseStyle
?:
'
text
'
|
'
default
'
|
'
copy
'
;
/**
* Control the cursor style, either 'block' or 'line'.
* Defaults to 'line'.
...
...
src/vs/editor/contrib/dnd/browser/dnd.css
浏览文件 @
49b27148
...
...
@@ -14,4 +14,11 @@
.monaco-editor.hc-black
.dnd-target
{
border-right
:
2px
dotted
#fff
;
color
:
#000
;
/* opposite of #fff */
}
.monaco-editor.mouse-default
.view-lines
{
cursor
:
default
;
}
.monaco-editor.mouse-copy
.view-lines
{
cursor
:
copy
;
}
\ No newline at end of file
src/vs/editor/contrib/dnd/browser/dnd.ts
浏览文件 @
49b27148
...
...
@@ -6,7 +6,9 @@
'
use strict
'
;
import
'
vs/css!./dnd
'
;
import
{
IMouseEvent
}
from
"
vs/base/browser/mouseEvent
"
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
ICodeEditor
,
IEditorMouseEvent
,
IMouseTarget
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
editorContribution
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -38,6 +40,18 @@ export class DragAndDropController implements editorCommon.IEditorContribution {
this
.
_dragSelection
=
null
;
}
private
isDragAndCopy
(
mouseEvent
:
IMouseEvent
)
{
if
(
isWindows
&&
mouseEvent
.
ctrlKey
)
{
return
true
;
}
if
(
!
isWindows
&&
mouseEvent
.
altKey
)
{
return
true
;
}
return
false
;
}
private
_onEditorMouseDrag
(
mouseEvent
:
IEditorMouseEvent
):
void
{
let
target
=
mouseEvent
.
target
;
...
...
@@ -50,6 +64,16 @@ export class DragAndDropController implements editorCommon.IEditorContribution {
}
}
if
(
this
.
isDragAndCopy
(
mouseEvent
.
event
))
{
this
.
_editor
.
updateOptions
({
mouseStyle
:
'
copy
'
});
}
else
{
this
.
_editor
.
updateOptions
({
mouseStyle
:
'
default
'
});
}
if
(
this
.
_dragSelection
.
containsPosition
(
target
.
position
))
{
this
.
_removeDecoration
();
}
else
{
...
...
@@ -71,10 +95,14 @@ export class DragAndDropController implements editorCommon.IEditorContribution {
});
this
.
_editor
.
setSelections
(
newSelections
);
}
else
if
(
!
this
.
_dragSelection
.
containsPosition
(
newCursorPosition
))
{
this
.
_editor
.
executeCommand
(
DragAndDropController
.
ID
,
new
DragAndDropCommand
(
this
.
_dragSelection
,
newCursorPosition
,
mouseEvent
.
event
.
altKey
));
this
.
_editor
.
executeCommand
(
DragAndDropController
.
ID
,
new
DragAndDropCommand
(
this
.
_dragSelection
,
newCursorPosition
,
this
.
isDragAndCopy
(
mouseEvent
.
event
)
));
}
}
this
.
_editor
.
updateOptions
({
mouseStyle
:
'
text
'
});
this
.
_removeDecoration
();
this
.
_dragSelection
=
null
;
}
...
...
src/vs/editor/contrib/dnd/common/dragAndDropCommand.ts
浏览文件 @
49b27148
...
...
@@ -15,17 +15,17 @@ export class DragAndDropCommand implements editorCommon.ICommand {
private
selection
:
Selection
;
private
targetPosition
:
Position
;
private
targetSelection
:
Selection
;
private
altKe
y
:
boolean
;
private
cop
y
:
boolean
;
constructor
(
selection
:
Selection
,
targetPosition
:
Position
,
altKe
y
:
boolean
)
{
constructor
(
selection
:
Selection
,
targetPosition
:
Position
,
cop
y
:
boolean
)
{
this
.
selection
=
selection
;
this
.
targetPosition
=
targetPosition
;
this
.
altKey
=
altKe
y
;
this
.
copy
=
cop
y
;
}
public
getEditOperations
(
model
:
editorCommon
.
ITokenizedModel
,
builder
:
editorCommon
.
IEditOperationBuilder
):
void
{
let
text
=
model
.
getValueInRange
(
this
.
selection
);
if
(
!
this
.
altKe
y
)
{
if
(
!
this
.
cop
y
)
{
builder
.
addEditOperation
(
this
.
selection
,
null
);
}
builder
.
addEditOperation
(
new
Range
(
this
.
targetPosition
.
lineNumber
,
this
.
targetPosition
.
column
,
this
.
targetPosition
.
lineNumber
,
this
.
targetPosition
.
column
),
text
);
...
...
@@ -35,7 +35,7 @@ export class DragAndDropCommand implements editorCommon.ICommand {
return
;
}
if
(
this
.
altKe
y
)
{
if
(
this
.
cop
y
)
{
this
.
targetSelection
=
new
Selection
(
this
.
targetPosition
.
lineNumber
,
this
.
targetPosition
.
column
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录