Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Do not save window size when resize is cancelled (#1465)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro authored and bluemarvin committed Jul 26, 2019
1 parent 7722f2b commit d239ccf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ private void exitResizeMode(ResizeAction aResizeAction) {
if (aResizeAction == ResizeAction.RESTORE_SIZE) {
mWindowWidget.getPlacement().copyFrom(mPlacementBeforeResize);
mWidgetManager.updateWidget(mWindowWidget);
mWindowWidget.saveCurrentSize();
}
mIsResizing = false;
finishWidgetResize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,8 @@ public void handleResizeEvent(float aWorldWidth, float aWorldHeight) {
mWidgetPlacement.height = (int) ((aWorldHeight * defaultHeight) / worldHeight) + mBorderWidth * 2;
mWidgetPlacement.worldWidth = aWorldWidth;
mWidgetManager.updateWidget(this);

if (mSaveResizeChanges) {
SettingsStore.getInstance(getContext()).setBrowserWorldWidth(aWorldWidth);
SettingsStore.getInstance(getContext()).setBrowserWorldHeight(aWorldHeight);
saveCurrentSize();
}
}

Expand Down Expand Up @@ -603,6 +601,12 @@ public void setNoInternetToastVisible(boolean aVisible) {
}
}

public void saveCurrentSize() {
final float aspect = (float)mWidgetPlacement.width / (float)mWidgetPlacement.height;
SettingsStore.getInstance(getContext()).setBrowserWorldWidth(mWidgetPlacement.worldWidth);
SettingsStore.getInstance(getContext()).setBrowserWorldHeight(mWidgetPlacement.worldWidth / aspect);
}

public void showAlert(String title, @NonNull String msg, @NonNull AlertCallback callback) {
mAlertPrompt = new AlertPromptWidget(getContext());
mAlertPrompt.mWidgetPlacement.parentHandle = getHandle();
Expand Down

0 comments on commit d239ccf

Please sign in to comment.