Commit caef5b16 by Kim Jinsung

Merge branch 'features/1.1.200' into features/1.2.0

parents ee443fea 3f86215c
......@@ -7,7 +7,7 @@
.drawing-board { position: relative; display: block; }
.drawing-board-canvas-wrapper { position: relative; margin: 0; border: 1px solid #ddd; }
.drawing-board-canvas-wrapper { position: relative; margin: auto; border: 1px solid #ddd; }
.drawing-board-canvas { position: absolute; top: 0; left: 0; z-index: 10; width: auto; }
......
......@@ -76,8 +76,8 @@
});
//Canvasのサイズを写真の横縦割合に合わせて変更
function resizeCanvasToRatio(ratio){
aisEditTool.resizeCanvasToRatio(ratio);
function resizeCanvasToRatio(ratio, maxHeight){
aisEditTool.resizeCanvasToRatio(ratio, maxHeight);
}
//CanvasのBackgroundをイメージファイルのurlに設定
......
......@@ -971,7 +971,9 @@ DrawingBoard.Board.prototype = {
},
//Canvasのサイズを写真の横縦割合に合わせて変更
resizeCanvasToRatio: function(ratio){
resizeCanvasToRatio: function(ratio, maxHeight){
var minWidth = 240;
//上位クラスの横幅と縦幅を修正
this.$el.width('100%');
this.$el.height('100%');
......@@ -979,6 +981,13 @@ DrawingBoard.Board.prototype = {
var w = this.$el.width();
var h = w*ratio; //横幅によって縦幅を決める。
if(w < minWidth){
h = maxHeight
w = h / ratio;
}
this.dom.$controls.width(188);
//Canvasの縁のサイズを設定
this.dom.$canvasWrapper.css('width', w + 'px');
this.dom.$canvasWrapper.css('height', h + 'px');
......
......@@ -37,10 +37,13 @@ public class PhotoEditActivity extends Dialog {
private final String TAG = "PhotoEditActivity";
private final String editToolPath = "file:///android_asset/Drawing/index.html"; //EditToolのパス。
private final String editToolName = "Drawing"; //EditToolの名
private final int dialogMinWidthWeb = 280; //ダイアローグの最小の横幅
private WebView editPageWebView; //ダイアローグの上に編集画面をロード
private Bitmap bitmapOfPhoto; //写真のBitmap情報
private float photoWidth;
private float photoHeight;
private float displayHeight;
private float displayDensity;
private String photoFilePath; //ロードして修正するファイルのパス
private JsInf jsInf = new JsInf(); //Javascript Interface
private Context context;
......@@ -79,7 +82,8 @@ public class PhotoEditActivity extends Dialog {
Window window = ((Activity) context).getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);
float photoRatio = photoWidth / photoHeight; //画面の横と縦の割合
float displayHeight = (float) displayRectangle.height(); //画面の縦幅
displayHeight = (float) displayRectangle.height(); //画面の縦幅
displayDensity = getContext().getResources().getDisplayMetrics().density;
float displayWidth = (float) displayRectangle.width(); //画面の横幅
int dialogWidth = (int) (displayHeight * photoRatio); //ダイアローグの横幅を縦幅について計算
......@@ -89,10 +93,13 @@ public class PhotoEditActivity extends Dialog {
if(getWindow() != null) {
if (dialogWidth < displayWidth) {
//計算した横幅が画面より小さい場合はそのまま設定
if (dialogWidth < dialogMinWidthWeb * displayDensity){
dialogWidth = (int) (dialogMinWidthWeb * displayDensity);
}
getWindow().setLayout(dialogWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
} else {
//計算した横幅が画面より大き場合は画面の横幅に反映
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
getWindow().setLayout((int) displayWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
}
}
......@@ -130,7 +137,7 @@ public class PhotoEditActivity extends Dialog {
//最初ページロードの場合
//ページロードの終了後のCanvas設定
float photoRatio = photoHeight / photoWidth; //写真の割合を計算
view.loadUrl(String.format("javascript:resizeCanvasToRatio(%f);", photoRatio)); //写真の割合によってCanvasのサイズを決める。
view.loadUrl(String.format("javascript:resizeCanvasToRatio(%f, %f);", photoRatio, (displayHeight / displayDensity * 0.7f))); //写真の割合によってCanvasのサイズを決める。
view.loadUrl(String.format("javascript:setBackground('%s');", photoFilePath)); //Canvasの背景をイメージにする
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment