MViewer¶
MViewer Framework 에 대한 필수 API 를 정의
Viewer API¶
문서 뷰어 관련 기능을 제공한다.
문서 뷰어 이동¶
-
M.
plugin
('viewer.doc').open( setting)¶ Changed in version 2.1.4.4.
- Arguments
setting (Object) – 문서 뷰어를 위한 설정 정보
setting.path (String) – 문서 저장 경로
setting.orientation (String) – 화면 오리엔테이션 ( _OrientationType )
setting.animation (String) – 화면 애니메이션 ( _AnimationType )
로컬에 있는 문서를 보기위한 화면으로 이동한다.
- Surrogate Keys: 위 옵션키들과 같은 하위 버전 호환을 위한 대체 옵션 값들
alias = path
source = path
url = path
orient = orientation
orientationtype = orientation
animate = animation
animationtype = animation
Example:
var remote_url = 'http://research.google.com/archive/bigtable-osdi06.pdf';
M.net.http.download(remote_url, {
finish : function(status, header, fileinfo, setting) {
// TODO : upload finished code here.
console.log(status, JSON.stringify(header, null, 4), JSON.stringify(fileinfo, null, 4), setting);
if (status == 200) {
// NOTICE : download 받은 pdf 파일을 viewer로 연다.
var localpath = fileinfo.fullpath;
var result = M.plugin('viewer.doc').open(localpath);
if( result.status != 'SUCCESS' ) {
// TODO : case1) 파일을 찾을 수 없는 경우
// TODO : case2) 열수없는 확장자인 경우(iOS only)
}
}
else if( status == -1 ) {
// TODO : 데이터 통신을 못한경우
}
else {
// TODO : 404, 500 error 등
}
},
progress : function(total, current, setting) {
// TODO : web download progress event code here.
console.log(total, current);
}
});
구글 뷰어 이동 (DEPRECATED)¶
-
M.
plugin
('viewer.doc').open( setting)¶ Changed in version 2.1.4.4.
- Arguments
setting (Object) – 문서 뷰어를 위한 설정 정보
setting.url (String) – 문서 url
setting.orientation (String) – 화면 오리엔테이션 ( _OrientationType )
setting.animation (String) – 화면 애니메이션 ( _AnimationType )
구글 뷰어 화면으로 이동한다.
- Surrogate Keys: 위 옵션키들과 같은 하위 버전 호환을 위한 대체 옵션 값들
orient = orientation
orientationtype = orientation
animate = animation
animationtype = animation
Example:
var result = M.plugin('viewer.doc').gview({
url: 'https://s3-ap-northeast-1.amazonaws.com/morpheus-storage/lab/documents/morpheus_2.0_introduce_v1.3.modified.pdf',
orientation: 'PORTRAIT'
});
console.log( JSON.stringify( result ) );
Orientation Type¶
모든 Orientation 값은 Application 설정에 영향을 받음
Manifest.xml 에서도 orient 값이 DEFAULT 인 경우 Application 설정의 첫번째 값을 적용
Type |
Int |
Description |
---|---|---|
DEFAULT |
0 |
Manifest.xml 에서 설정한 orient 값 적용 |
PORTRAIT |
1 |
세로모드, 홈버튼이 아래인 세로 방향으로 회전 유지 |
PORT |
1 |
PORTRAIT 을 축약 |
LANDSCAPE |
2 |
가로모드, 왼쪽 회전된 상태 유지 |
LAND |
2 |
LANDSCAPE 를 축약 |
PORTRAIT|REVERSE |
3 |
세로모드, 세로 방향만 허용, 회전 가능 |
PORT|REVERSE |
3 |
PORTRAIT 을 축약 |
PORTREV |
3 |
PORTRAIT|REVERSE 를 축약 |
LANDSCAPE|REVERSE |
4 |
가로모드, 가로 방향만 허용, 회전 가능 |
LAND|REVERSE |
4 |
LANDSCAPE 를 축약 |
LANDREV |
4 |
LANDSCAPE|REVERSE 를 축약 |
ALL |
5 |
모든 방향으로 허용 |
Animation Type¶
Manifest.xml 에서도 animate 값이 DEFAULT 인 경우 SLIDE_LEFT 적용
Type |
Int |
Description |
---|---|---|
DEFAULT |
0 |
Manifest.xml 에서 설정한 animate 값 적용 |
NONE |
1 |
애니메이션 효과 없음 |
SLIDE_LEFT |
2 |
왼쪽으로 이동되는 슬라이드 효과 |
SLIDE_RIGHT |
3 |
오른쪽으로 이동되는 슬라이드 효과 |
SLIDE_TOP |
4 |
위쪽으로 이동되는 슬라이드 효과 |
SLIDE_BOTTOM |
5 |
아래쪽으로 이동되는 슬라이드 효과 |
ZOOM_IN |
6 |
줌인 효과 |
ZOOM_OUT |
7 |
줌아웃 효과 |
FADE |
8 |
페이드 효과 |
MODAL_UP |
9 |
원본 화면은 고정되어 있고 대상 화면만 위쪽으로 이동되는 슬라이드 효과 |
MODAL_DOWN |
10 |
원본 화면은 고정되어 있고 대상 화면만 아래쪽으로 이동되는 슬라이드 효과 |