Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
b37c15ec
I
incubator-echarts
项目概览
半栈学徒
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
incubator-echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b37c15ec
编写于
11月 29, 2015
作者:
P
pah100
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add pinch
上级
a394304b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
66 addition
and
40 deletion
+66
-40
src/chart/treemap/TreemapView.js
src/chart/treemap/TreemapView.js
+1
-1
src/component/dataZoom/InsideZoomView.js
src/component/dataZoom/InsideZoomView.js
+0
-4
src/component/helper/RoamController.js
src/component/helper/RoamController.js
+16
-31
src/component/tooltip/TooltipContent.js
src/component/tooltip/TooltipContent.js
+28
-0
test/config.js
test/config.js
+2
-1
test/lib/facePrint.js
test/lib/facePrint.js
+16
-2
test/map.html
test/map.html
+3
-1
未找到文件。
src/chart/treemap/TreemapView.js
浏览文件 @
b37c15ec
...
@@ -553,7 +553,7 @@
...
@@ -553,7 +553,7 @@
* @private
* @private
*/
*/
_onZoom
:
function
(
scale
,
mouseX
,
mouseY
)
{
_onZoom
:
function
(
scale
,
mouseX
,
mouseY
)
{
if
(
this
.
_state
!==
'
animating
'
&&
!
this
.
_controller
.
isDragging
()
)
{
if
(
this
.
_state
!==
'
animating
'
)
{
// These param must not be cached.
// These param must not be cached.
var
viewRoot
=
this
.
seriesModel
.
getViewRoot
();
var
viewRoot
=
this
.
seriesModel
.
getViewRoot
();
...
...
src/component/dataZoom/InsideZoomView.js
浏览文件 @
b37c15ec
...
@@ -89,10 +89,6 @@ define(function (require) {
...
@@ -89,10 +89,6 @@ define(function (require) {
* @private
* @private
*/
*/
_onZoom
:
function
(
controller
,
coordInfo
,
scale
,
mouseX
,
mouseY
)
{
_onZoom
:
function
(
controller
,
coordInfo
,
scale
,
mouseX
,
mouseY
)
{
if
(
controller
.
isDragging
())
{
return
;
}
var
dataZoomModel
=
this
.
dataZoomModel
;
var
dataZoomModel
=
this
.
dataZoomModel
;
var
range
=
scaleCartesian
(
var
range
=
scaleCartesian
(
scale
,
[
mouseX
,
mouseY
],
dataZoomModel
.
getRange
(),
scale
,
[
mouseX
,
mouseY
],
dataZoomModel
.
getRange
(),
...
...
src/component/helper/RoamController.js
浏览文件 @
b37c15ec
...
@@ -23,7 +23,8 @@ define(function (require) {
...
@@ -23,7 +23,8 @@ define(function (require) {
}
}
function
mousemove
(
e
)
{
function
mousemove
(
e
)
{
if
(
this
.
_dragging
&&
!
this
.
_pinching
)
{
if
(
this
.
_dragging
&&
e
.
gestureEvent
!==
'
pinchchange
'
)
{
var
rawE
=
e
.
event
;
var
rawE
=
e
.
event
;
rawE
.
preventDefault
&&
rawE
.
preventDefault
();
rawE
.
preventDefault
&&
rawE
.
preventDefault
();
...
@@ -54,29 +55,19 @@ define(function (require) {
...
@@ -54,29 +55,19 @@ define(function (require) {
}
}
function
mousewheel
(
e
)
{
function
mousewheel
(
e
)
{
var
scale
=
e
.
wheelDelta
>
0
?
1.1
:
1
/
1.1
;
var
zoomDelta
=
e
.
wheelDelta
<
0
?
1.1
:
1
/
1.1
;
zoom
.
call
(
this
,
e
,
scale
);
zoom
.
call
(
this
,
e
,
zoomDelta
,
e
.
offsetX
,
e
.
offsetY
);
}
function
pinchstart
()
{
this
.
_pinching
=
true
;
}
function
pinchchange
(
e
)
{
var
scale
=
e
.
deltaScale
>
1
?
1.1
:
1
/
1.1
;
zoom
.
call
(
this
,
e
,
scale
);
}
}
function
pinchend
()
{
function
pinch
(
e
)
{
this
.
_pinching
=
false
;
var
zoomDelta
=
e
.
pinchScale
>
1
?
1.1
:
1
/
1.1
;
zoom
.
call
(
this
,
e
,
zoomDelta
,
e
.
pinchX
,
e
.
pinchY
);
}
}
function
zoom
(
e
,
eventScale
)
{
function
zoom
(
e
,
zoomDelta
,
zoomX
,
zoomY
)
{
var
mouseX
=
e
.
offsetX
;
var
mouseY
=
e
.
offsetY
;
var
rect
=
this
.
rect
;
var
rect
=
this
.
rect
;
if
(
rect
&&
rect
.
contain
(
mouseX
,
mouse
Y
))
{
if
(
rect
&&
rect
.
contain
(
zoomX
,
zoom
Y
))
{
var
target
=
this
.
target
;
var
target
=
this
.
target
;
...
@@ -85,7 +76,7 @@ define(function (require) {
...
@@ -85,7 +76,7 @@ define(function (require) {
var
scale
=
target
.
scale
;
var
scale
=
target
.
scale
;
var
newZoom
=
this
.
_zoom
=
this
.
_zoom
||
1
;
var
newZoom
=
this
.
_zoom
=
this
.
_zoom
||
1
;
newZoom
*=
eventScale
;
newZoom
*=
zoomDelta
;
// newZoom = Math.max(
// newZoom = Math.max(
// Math.min(target.maxZoom, newZoom),
// Math.min(target.maxZoom, newZoom),
// target.minZoom
// target.minZoom
...
@@ -93,15 +84,15 @@ define(function (require) {
...
@@ -93,15 +84,15 @@ define(function (require) {
var
zoomScale
=
newZoom
/
this
.
_zoom
;
var
zoomScale
=
newZoom
/
this
.
_zoom
;
this
.
_zoom
=
newZoom
;
this
.
_zoom
=
newZoom
;
// Keep the mouse center when scaling
// Keep the mouse center when scaling
pos
[
0
]
-=
(
mouse
X
-
pos
[
0
])
*
(
zoomScale
-
1
);
pos
[
0
]
-=
(
zoom
X
-
pos
[
0
])
*
(
zoomScale
-
1
);
pos
[
1
]
-=
(
mouse
Y
-
pos
[
1
])
*
(
zoomScale
-
1
);
pos
[
1
]
-=
(
zoom
Y
-
pos
[
1
])
*
(
zoomScale
-
1
);
scale
[
0
]
*=
zoomScale
;
scale
[
0
]
*=
zoomScale
;
scale
[
1
]
*=
zoomScale
;
scale
[
1
]
*=
zoomScale
;
target
.
dirty
();
target
.
dirty
();
}
}
this
.
trigger
(
'
zoom
'
,
eventScale
,
mouseX
,
mouse
Y
);
this
.
trigger
(
'
zoom
'
,
zoomDelta
,
zoomX
,
zoom
Y
);
}
}
}
}
...
@@ -132,9 +123,7 @@ define(function (require) {
...
@@ -132,9 +123,7 @@ define(function (require) {
var
mousemoveHandler
=
bind
(
mousemove
,
this
);
var
mousemoveHandler
=
bind
(
mousemove
,
this
);
var
mouseupHandler
=
bind
(
mouseup
,
this
);
var
mouseupHandler
=
bind
(
mouseup
,
this
);
var
mousewheelHandler
=
bind
(
mousewheel
,
this
);
var
mousewheelHandler
=
bind
(
mousewheel
,
this
);
var
pinchstartHandler
=
bind
(
pinchstart
,
this
);
var
pinchHandler
=
bind
(
pinch
,
this
);
var
pinchchangeHandler
=
bind
(
pinchchange
,
this
);
var
pinchendHandler
=
bind
(
pinchend
,
this
);
Eventful
.
call
(
this
);
Eventful
.
call
(
this
);
...
@@ -154,9 +143,7 @@ define(function (require) {
...
@@ -154,9 +143,7 @@ define(function (require) {
}
}
if
(
controlType
&&
controlType
!==
'
pan
'
)
{
if
(
controlType
&&
controlType
!==
'
pan
'
)
{
zr
.
on
(
'
mousewheel
'
,
mousewheelHandler
);
zr
.
on
(
'
mousewheel
'
,
mousewheelHandler
);
zr
.
on
(
'
pinchstart
'
,
pinchstartHandler
);
zr
.
on
(
'
pinch
'
,
pinchHandler
);
zr
.
on
(
'
pinchchange
'
,
pinchchangeHandler
);
zr
.
on
(
'
pinchend
'
,
pinchendHandler
);
}
}
};
};
...
@@ -165,9 +152,7 @@ define(function (require) {
...
@@ -165,9 +152,7 @@ define(function (require) {
zr
.
off
(
'
mousemove
'
,
mousemoveHandler
);
zr
.
off
(
'
mousemove
'
,
mousemoveHandler
);
zr
.
off
(
'
mouseup
'
,
mouseupHandler
);
zr
.
off
(
'
mouseup
'
,
mouseupHandler
);
zr
.
off
(
'
mousewheel
'
,
mousewheelHandler
);
zr
.
off
(
'
mousewheel
'
,
mousewheelHandler
);
zr
.
off
(
'
pinchstart
'
,
pinchstartHandler
);
zr
.
off
(
'
pinch
'
,
pinchHandler
);
zr
.
off
(
'
pinchchange
'
,
pinchchangeHandler
);
zr
.
off
(
'
pinchend
'
,
pinchendHandler
);
};
};
this
.
dispose
=
this
.
disable
;
this
.
dispose
=
this
.
disable
;
...
...
src/component/tooltip/TooltipContent.js
浏览文件 @
b37c15ec
...
@@ -5,6 +5,7 @@ define(function (require) {
...
@@ -5,6 +5,7 @@ define(function (require) {
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
zrColor
=
require
(
'
zrender/tool/color
'
);
var
zrColor
=
require
(
'
zrender/tool/color
'
);
var
eventUtil
=
require
(
'
zrender/core/event
'
);
var
formatUtil
=
require
(
'
../../util/format
'
);
var
formatUtil
=
require
(
'
../../util/format
'
);
var
each
=
zrUtil
.
each
;
var
each
=
zrUtil
.
each
;
var
toCamelCase
=
formatUtil
.
toCamelCase
;
var
toCamelCase
=
formatUtil
.
toCamelCase
;
...
@@ -142,6 +143,33 @@ define(function (require) {
...
@@ -142,6 +143,33 @@ define(function (require) {
}
}
self
.
_inContent
=
false
;
self
.
_inContent
=
false
;
};
};
compromiseMobile
(
el
,
container
);
}
function
compromiseMobile
(
tooltipContentEl
,
container
)
{
// Prevent default behavior on mobile. For example,
// defuault pinch gesture will cause browser zoom.
// We do not preventing event on tooltip contnet el,
// because user may need customization in tooltip el.
eventUtil
.
addEventListener
(
container
,
'
touchstart
'
,
preventDefault
);
eventUtil
.
addEventListener
(
container
,
'
touchmove
'
,
preventDefault
);
eventUtil
.
addEventListener
(
container
,
'
touchend
'
,
preventDefault
);
function
preventDefault
(
e
)
{
if
(
contains
(
e
.
target
))
{
e
.
preventDefault
();
}
}
function
contains
(
targetEl
)
{
while
(
targetEl
&&
targetEl
!==
container
)
{
if
(
targetEl
===
tooltipContentEl
)
{
return
true
;
}
targetEl
=
targetEl
.
parentNode
;
}
}
}
}
TooltipContent
.
prototype
=
{
TooltipContent
.
prototype
=
{
...
...
test/config.js
浏览文件 @
b37c15ec
...
@@ -2,7 +2,8 @@ require.config({
...
@@ -2,7 +2,8 @@ require.config({
paths
:
{
paths
:
{
'
geoJson
'
:
'
../geoData/geoJson
'
,
'
geoJson
'
:
'
../geoData/geoJson
'
,
'
theme
'
:
'
../theme
'
,
'
theme
'
:
'
../theme
'
,
'
data
'
:
'
./data
'
'
data
'
:
'
./data
'
,
'
map
'
:
'
../map
'
},
},
packages
:
[
packages
:
[
{
{
...
...
test/lib/facePrint.js
浏览文件 @
b37c15ec
...
@@ -5,18 +5,32 @@
...
@@ -5,18 +5,32 @@
var
infoDom
;
var
infoDom
;
var
msgs
=
[];
var
msgs
=
[];
var
count
=
0
;
window
.
facePrint
=
function
(
msg
,
delimiter
,
max
)
{
window
.
facePrint
=
function
(
msg
,
delimiter
,
max
)
{
if
(
!
infoDom
)
{
if
(
!
infoDom
)
{
infoDom
=
createInfoDom
();
infoDom
=
createInfoDom
();
}
}
msgs
.
push
(
encodeHTML
(
msg
));
msgs
.
push
(
encodeHTML
(
msg
));
count
++
;
if
(
msgs
.
length
>
(
max
||
5
0
))
{
if
(
msgs
.
length
>
(
max
||
3
0
))
{
msgs
.
shift
();
msgs
.
shift
();
}
}
infoDom
.
innerHTML
=
msgs
.
join
(
delimiter
||
'
'
);
if
(
delimiter
)
{
infoDom
.
innerHTML
=
msgs
.
join
(
delimiter
);
}
else
{
var
str
=
''
;
// Make some change in view, otherwise user may
// be not aware that log is still printing.
for
(
var
i
=
0
;
i
<
msgs
.
length
;
i
++
)
{
str
+=
msgs
[
i
]
+
'
'
+
(
count
-
msgs
.
length
+
i
)
+
'
'
;
}
infoDom
.
innerHTML
=
str
;
}
};
};
function
createInfoDom
()
{
function
createInfoDom
()
{
...
...
test/map.html
浏览文件 @
b37c15ec
<html>
<html>
<head>
<head>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<script
src=
"esl.js"
></script>
<script
src=
"esl.js"
></script>
<script
src=
"config.js"
></script>
<script
src=
"config.js"
></script>
<script
src=
"lib/jquery.min.js"
></script>
<script
src=
"lib/jquery.min.js"
></script>
<script
src=
"lib/facePrint.js"
></script>
</head>
</head>
<body>
<body>
<style>
<style>
...
@@ -25,7 +27,7 @@
...
@@ -25,7 +27,7 @@
'
echarts/component/dataRange
'
'
echarts/component/dataRange
'
],
function
(
echarts
)
{
],
function
(
echarts
)
{
require
([
'
map/china
'
],
function
()
{
require
([
'
map/
js/
china
'
],
function
()
{
var
chart
=
echarts
.
init
(
document
.
getElementById
(
'
main
'
),
null
,
{
var
chart
=
echarts
.
init
(
document
.
getElementById
(
'
main
'
),
null
,
{
renderer
:
'
canvas
'
renderer
:
'
canvas
'
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录