2012-08-07 07:39:03 -07:00
|
|
|
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
package org.mozilla.gecko;
|
|
|
|
|
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
public final class ZoomConstraints {
|
|
|
|
private final boolean mAllowZoom;
|
2014-02-24 16:21:02 -08:00
|
|
|
private final boolean mAllowDoubleTapZoom;
|
2012-08-07 07:39:03 -07:00
|
|
|
private final float mDefaultZoom;
|
|
|
|
private final float mMinZoom;
|
|
|
|
private final float mMaxZoom;
|
|
|
|
|
|
|
|
public ZoomConstraints(boolean allowZoom) {
|
|
|
|
mAllowZoom = allowZoom;
|
2014-02-24 16:21:02 -08:00
|
|
|
mAllowDoubleTapZoom = allowZoom;
|
2012-08-07 07:39:03 -07:00
|
|
|
mDefaultZoom = 0.0f;
|
|
|
|
mMinZoom = 0.0f;
|
|
|
|
mMaxZoom = 0.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
ZoomConstraints(JSONObject message) throws JSONException {
|
|
|
|
mAllowZoom = message.getBoolean("allowZoom");
|
2014-02-24 16:21:02 -08:00
|
|
|
mAllowDoubleTapZoom = message.getBoolean("allowDoubleTapZoom");
|
2012-08-07 07:39:03 -07:00
|
|
|
mDefaultZoom = (float)message.getDouble("defaultZoom");
|
|
|
|
mMinZoom = (float)message.getDouble("minZoom");
|
|
|
|
mMaxZoom = (float)message.getDouble("maxZoom");
|
|
|
|
}
|
|
|
|
|
|
|
|
public final boolean getAllowZoom() {
|
|
|
|
return mAllowZoom;
|
|
|
|
}
|
|
|
|
|
2014-02-24 16:21:02 -08:00
|
|
|
public final boolean getAllowDoubleTapZoom() {
|
|
|
|
return mAllowDoubleTapZoom;
|
|
|
|
}
|
|
|
|
|
2012-08-07 07:39:03 -07:00
|
|
|
public final float getDefaultZoom() {
|
|
|
|
return mDefaultZoom;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final float getMinZoom() {
|
|
|
|
return mMinZoom;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final float getMaxZoom() {
|
|
|
|
return mMaxZoom;
|
|
|
|
}
|
|
|
|
}
|