0

すべてのダイアログ ウィンドウは、画面外に移動できます (水平または垂直は関係ありません)。このウィンドウが画面の背後にある場合、さらにドラッグし続けると、画面のコンテンツが移動します。

難しそうですが、最終的には以下のようになります。 ここに画像の説明を入力

次の変更cssはあまり役に立ちません。

body {
    ...
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    overflow-y: hidden;
    overflow-x: hidden;
    ...
}


html {
    overflow-y: hidden;
    background-color: transparent;
}

ダイアログ ウィンドウをそこに移動すると、垂直および水平スクロール バーが表示されません。しかし、メイン画面よりも大きなサイズのダイアログ ウィンドウがある場合、スクロール バーも表示されません。これは別の問題です。

ダイアログ ウィンドウが画面外に移動しないようにする方法 (簡単な例、Google ドライブのダイアログ ウィンドウ - 画面の表示部分でのみ移動します)。

4

1 に答える 1

0

endDraggingDialogBoxのメソッドをオーバーライドすることで、探していた解決策にたどり着きました。ここにあります:

@Override
protected void endDragging(MouseUpEvent event)
{
    //Move dialog window behind top border
    if(this.getAbsoluteTop() < 0) {
        this.setPopupPosition(this.getPopupLeft(), 0);
    }
    //Move dialog window behind bottom border
    if(this.getAbsoluteTop() > (Window.getClientHeight() - this.getOffsetHeight())) {
        this.setPopupPosition(this.getPopupLeft(), Window.getClientHeight() - this.getOffsetHeight());
    }

    //Move dialog window behind left border
    if(this.getAbsoluteLeft() < 0) {
        this.setPopupPosition(0, this.getPopupTop());
    }
    //Move dialog window behind right border
    if(this.getAbsoluteLeft() > (Window.getClientWidth() - this.getOffsetWidth())) {
        this.setPopupPosition(Window.getClientWidth() - this.getOffsetWidth(), this.getPopupTop());
    }
    super.endDragging(event);
}

ダイアログ ボックスが画面外に移動すると、マウスを放した後に画面の可視部分に表示されます。continueDraggingウィンドウが画面外に移動するのを防ぐために、それを改善してオーバーライドすることができます。

于 2013-10-24T23:43:24.217 に答える