Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
0c3fb0ba
Commit
0c3fb0ba
authored
Feb 28, 2019
by
Lee Jaebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
メモの座標変換を元のソースに修正
parent
927e55be
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
6 deletions
+40
-6
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/view/ZoomRelativeLayout.java
+40
-6
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/view/ZoomRelativeLayout.java
View file @
0c3fb0ba
...
@@ -4,6 +4,7 @@ import android.content.Context;
...
@@ -4,6 +4,7 @@ import android.content.Context;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
import
android.graphics.Canvas
;
import
android.graphics.Canvas
;
import
android.graphics.Matrix
;
import
android.graphics.Matrix
;
import
android.graphics.Point
;
import
android.graphics.PointF
;
import
android.graphics.PointF
;
import
android.view.DragEvent
;
import
android.view.DragEvent
;
import
android.view.GestureDetector
;
import
android.view.GestureDetector
;
...
@@ -636,9 +637,9 @@ public class ZoomRelativeLayout extends RelativeLayout {
...
@@ -636,9 +637,9 @@ public class ZoomRelativeLayout extends RelativeLayout {
for
(
int
i
=
0
;
i
<
listMemo
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
listMemo
.
size
();
i
++)
{
// アイコン追加
// アイコン追加
ContentMemoDto
dto
=
listMemo
.
get
(
i
);
ContentMemoDto
dto
=
listMemo
.
get
(
i
);
Point
F
point
=
convertToAuthoring
Point
(
dto
.
axisX
,
dto
.
axisY
);
Point
point
=
convertToMemoView
Point
(
dto
.
axisX
,
dto
.
axisY
);
dto
.
viewX
=
(
int
)
point
.
x
;
dto
.
viewX
=
point
.
x
;
dto
.
viewY
=
(
int
)
point
.
y
;
dto
.
viewY
=
point
.
y
;
MemoManager
.
addMemoIcon
(
this
,
dto
);
MemoManager
.
addMemoIcon
(
this
,
dto
);
}
}
}
}
...
@@ -701,12 +702,45 @@ public class ZoomRelativeLayout extends RelativeLayout {
...
@@ -701,12 +702,45 @@ public class ZoomRelativeLayout extends RelativeLayout {
}
}
}
}
public
Point
convertToMemoViewPoint
(
float
x
,
float
y
)
{
Logger
.
d
(
TAG
,
"convertToViewPoint:x=%s, y=%s"
,
x
,
y
);
// オーサリング基準座標から変換PDF基準座標に変換
float
scale
=
Math
.
min
(
getDefaultPDFWidth
()
/
(
float
)
mAuthoringPageSize
.
width
,
getDefaultPDFHeight
()
/
(
float
)
mAuthoringPageSize
.
height
);
float
pdfX
=
x
*
scale
;
float
pdfY
=
y
*
scale
;
Logger
.
d
(
TAG
,
"convertToMemoViewPoint:scale=%s scaledWidth=%s, scaledHeight=%s pdfX=%s, pdfY=%s"
,
scale
,
getDefaultPDFWidth
(),
getDefaultPDFHeight
(),
pdfX
,
pdfY
);
// PDF座標からタッチ座標に変換
float
viewX
=
pdfX
+
margin
.
left
;
float
viewY
=
pdfY
+
margin
.
top
;
Logger
.
d
(
TAG
,
"convertToMemoViewPoint:marginX=%s, marginY=%s, mPdfScale=%s viewX=%s, viewY=%s"
,
margin
.
left
,
margin
.
top
,
mPdfScale
,
viewX
,
viewY
);
Point
point
=
new
Point
((
int
)
viewX
,
(
int
)
viewY
);
return
point
;
}
public
Point
convertToMemoAuthoringPoint
(
float
x
,
float
y
)
{
Logger
.
d
(
TAG
,
"convertToMemoAuthoringPoint:x=%s, y=%s"
,
x
,
y
);
// タッチ座標からPDF座標に変換
mPdfScale
=
Math
.
min
(
getWidth
()
/
(
float
)
mPdfSize
.
width
,
getHeight
()
/
(
float
)
mPdfSize
.
height
);
float
marginX
=
getMarginX
(
mPdfScale
);
float
marginY
=
getMarginY
(
mPdfScale
);
float
pdfX
=
x
-
marginX
;
float
pdfY
=
y
-
marginY
;
Logger
.
d
(
TAG
,
"convertToMemoAuthoringPoint:marginX=%s, marginY=%s, mPdfScale=%s pdfX=%s, pdfY=%s"
,
margin
.
left
,
margin
.
top
,
mPdfScale
,
pdfX
,
pdfY
);
// 変換PDF基準座標からオーサリング基準座標に変換
float
scale
=
Math
.
min
((
float
)
mAuthoringPageSize
.
width
/
getDefaultPDFWidth
(),
(
float
)
mAuthoringPageSize
.
height
/
getDefaultPDFHeight
());
Point
point
=
new
Point
((
int
)(
pdfX
*
scale
),
(
int
)(
pdfY
*
scale
));
Logger
.
d
(
TAG
,
"convertToAuthoringPoint:scale=%s scaledWidth=%s, scaledHeight=%s authX=%s, auyhY=%s"
,
scale
,
getDefaultPDFWidth
(),
getDefaultPDFHeight
(),
(
pdfX
*
scale
),
(
pdfY
*
scale
));
return
point
;
}
public
boolean
isLeftSideOfPdf
(
int
x
)
{
public
boolean
isLeftSideOfPdf
(
int
x
)
{
return
x
<
mAuthoringPageSize
.
width
/
2
;
return
x
<
mAuthoringPageSize
.
width
/
2
;
}
}
private
void
showMemoMenu
(
final
float
x
,
final
float
y
)
{
private
void
showMemoMenu
(
final
float
x
,
final
float
y
)
{
final
Point
F
convertedPoint
=
convertT
oAuthoringPoint
(
x
,
y
);
final
Point
convertedPoint
=
convertToMem
oAuthoringPoint
(
x
,
y
);
if
(
contentMemoDao
.
getCopiedMemo
()
!=
null
)
{
if
(
contentMemoDao
.
getCopiedMemo
()
!=
null
)
{
// メモのコピーまたは切り取り中
// メモのコピーまたは切り取り中
final
ABVPopupListWindow
memoPopupWindow
=
createSimplePopupWindow
();
final
ABVPopupListWindow
memoPopupWindow
=
createSimplePopupWindow
();
...
@@ -721,8 +755,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
...
@@ -721,8 +755,8 @@ public class ZoomRelativeLayout extends RelativeLayout {
if
(
position
==
0
)
{
if
(
position
==
0
)
{
// 新規
// 新規
ContentMemoDto
dto
=
new
ContentMemoDto
();
ContentMemoDto
dto
=
new
ContentMemoDto
();
dto
.
axisX
=
(
int
)
convertedPoint
.
x
;
dto
.
axisX
=
convertedPoint
.
x
;
dto
.
axisY
=
(
int
)
convertedPoint
.
y
;
dto
.
axisY
=
convertedPoint
.
y
;
dto
.
viewX
=
(
int
)
x
;
dto
.
viewX
=
(
int
)
x
;
dto
.
viewY
=
(
int
)
y
;
dto
.
viewY
=
(
int
)
y
;
dto
.
contentId
=
mContentDto
.
contentId
;
dto
.
contentId
=
mContentDto
.
contentId
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment