Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 24 additions & 130 deletions src/qml/BookmarkList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,27 @@ import Theme
/**
* \ingroup qml
*/
Pane {
QfPaneDrawer {
id: bookmarkList
property alias model: bookmarksList.model
property bool multiSelection: false
property bool fullScreenView: false
property bool isVertical: parent.width < parent.height || parent.width < 300
property bool isDragging: false
property real dragHeightAdjustment: 0
property real dragWidthAdjustment: 0
property real lastWidth

width: {
if (props.isVisible) {
if (dragWidthAdjustment != 0) {
return lastWidth - dragWidthAdjustment;
} else if (fullScreenView || parent.width <= parent.height || width >= 0.95 * parent.width) {
lastWidth = parent.width;
return parent.width;
} else {
const newWidth = Math.min(Math.max(200, parent.width / 2.25), parent.width);
lastWidth = newWidth;
return newWidth;
}
} else {
lastWidth = 0;
return 0;
}
}
property real lastHeight

height: {
if (props.isVisible) {
if (dragHeightAdjustment != 0) {
return Math.min(lastHeight - dragHeightAdjustment, parent.height - mainWindow.sceneTopMargin);
} else if (fullScreenView || parent.width > parent.height || height >= 0.95 * parent.height) {
lastHeight = parent.height;
return parent.height;
} else {
const defaultMin = Math.min(Math.max(200, parent.height / 2), parent.height);
const minContentHeight = bookmarkListToolBar.height + (bookmarksList.contentHeight + bookmarksList.anchors.bottomMargin) + 25;
const newHeight = Math.min(minContentHeight, defaultMin);
lastHeight = newHeight;
return newHeight;
}
} else {
lastHeight = 0;
return 0;
}
}

topPadding: 0
leftPadding: 0
rightPadding: 0
bottomPadding: 0
contentVisible: props.isVisible
freezeKey: 'bookmarkresize'
headerHeight: bookmarkListToolBar.height
minContentHeight: bookmarkListToolBar.height + (bookmarksList.contentHeight + bookmarksList.anchors.bottomMargin) + 25

visible: props.isVisible
clip: true
onCollapsed: bookmarkList.hide()

WheelHandler {
acceptedDevices: PointerDevice.AllDevices
onWheel: {}
}
states: [
State {
name: "Hidden"
},
State {
name: "Visible"
}
]
state: "Hidden"

QtObject {
id: props
Expand Down Expand Up @@ -443,50 +402,6 @@ Pane {
}
}

function setMultiSelection(active) {
multiSelection = active;
if (model) {
model.hideProjectBookmarks = active;
}
}

function statusIndicatorDragged(deltaX, deltaY) {
fullScreenView = false;
if (isVertical) {
dragHeightAdjustment += deltaY;
} else {
dragWidthAdjustment += deltaX;
}
}

function statusIndicatorDragReleased() {
isDragging = false;
if (isVertical) {
const minContentHeight = bookmarkListToolBar.height + 48 + 30;
if (bookmarkList.height < minContentHeight) {
if (fullScreenView) {
fullScreenView = false;
} else {
bookmarkList.hide();
}
} else if (dragHeightAdjustment < -parent.height * 0.2) {
fullScreenView = true;
}
} else {
if (bookmarkList.width < bookmarkList.parent.width * 0.3) {
if (fullScreenView) {
fullScreenView = false;
} else {
bookmarkList.hide();
}
} else if (dragWidthAdjustment < -parent.width * 0.2) {
fullScreenView = true;
}
}
dragHeightAdjustment = 0;
dragWidthAdjustment = 0;
}

Keys.onReleased: event => {
if (event.key === Qt.Key_Back || event.key === Qt.Key_Escape) {
if (Overlay.overlay && Overlay.overlay.visibleChildren.length > 1 || (Overlay.overlay.visibleChildren.length === 1 && !toast.visible)) {
Expand All @@ -502,39 +417,17 @@ Pane {
}
}

Behavior on width {
enabled: !isDragging
PropertyAnimation {
duration: parent.width > parent.height ? 250 : 0
easing.type: Easing.OutQuart

onRunningChanged: {
if (running)
mapCanvasMap.freeze('bookmarkresize');
else
mapCanvasMap.unfreeze('bookmarkresize');
}
}
}

Behavior on height {
enabled: !isDragging
PropertyAnimation {
duration: parent.width < parent.height ? 250 : 0
easing.type: Easing.OutQuart

onRunningChanged: {
if (running)
mapCanvasMap.freeze('bookmarkresize');
else
mapCanvasMap.unfreeze('bookmarkresize');
}
}
}

function show() {
props.isVisible = true;
focus = true;
state = "Visible";
}

function setMultiSelection(active) {
multiSelection = active;
if (model) {
model.hideProjectBookmarks = active;
}
}

function hide() {
Expand All @@ -545,5 +438,6 @@ Pane {
if (bookmarkList.model) {
bookmarkList.model.clearSelection();
}
state = "Hidden";
}
}
143 changes: 17 additions & 126 deletions src/qml/FeatureListForm.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Theme
/**
* \ingroup qml
*/
Pane {
QfPaneDrawer {
id: featureFormList

property ProcessingAlgorithm algorithm: processingAlgorithm
Expand All @@ -49,15 +49,22 @@ Pane {
property bool allowDelete

property bool multiSelection: false
property bool fullScreenView: qfieldSettings.fullScreenIdentifyView
property bool isVertical: parent.width < parent.height || parent.width < 300

property bool isDragging: false
property real dragHeightAdjustment: 0
property real dragWidthAdjustment: 0
fullScreenView: qfieldSettings.fullScreenIdentifyView

property bool canvasOperationRequested: digitizingToolbar.geometryRequested || moveFeaturesToolbar.moveFeaturesRequested || rotateFeaturesToolbar.rotateFeaturesRequested

contentVisible: props.isVisible || featureFormList.canvasOperationRequested
freezeKey: 'formresize'
headerHeight: featureListToolBar.height
useDefaultMinHeight: featureFormList.state !== "FeatureList"
minContentHeight: featureListToolBar.height + (globalFeaturesList.contentHeight + globalFeaturesList.anchors.bottomMargin) + 25

onCollapsed: {
if (featureFormList.state !== 'FeatureFormEdit') {
featureFormList.state = 'Hidden';
}
}

signal showMessage(string message)
signal editGeometry
signal requestJumpToPoint(var center, real scale, bool handleMargins)
Expand All @@ -66,58 +73,11 @@ Pane {
featureForm.requestCancel();
}

property real lastWidth

width: {
if (props.isVisible || featureFormList.canvasOperationRequested) {
if (dragWidthAdjustment != 0) {
return lastWidth - dragWidthAdjustment;
} else if (fullScreenView || parent.width <= parent.height || width >= 0.95 * parent.width) {
lastWidth = parent.width;
return parent.width;
} else {
const newWidth = Math.min(Math.max(200, parent.width / 2.25), parent.width);
lastWidth = newWidth;
return newWidth;
}
} else {
lastWidth = 0;
return 0;
}
}
property real lastHeight

height: {
if (props.isVisible || featureFormList.canvasOperationRequested) {
if (dragHeightAdjustment != 0) {
return Math.min(lastHeight - dragHeightAdjustment, parent.height - mainWindow.sceneTopMargin);
} else if (fullScreenView || parent.width > parent.height || height >= 0.95 * parent.height) {
lastHeight = parent.height;
return parent.height;
} else {
const defaultMin = Math.min(Math.max(200, parent.height / 2), parent.height);
var minContentHeight = featureFormList.state !== "FeatureList" ? defaultMin : featureListToolBar.height + (globalFeaturesList.contentHeight + globalFeaturesList.anchors.bottomMargin) + 25;
const newHeight = Math.min(minContentHeight, defaultMin);
lastHeight = newHeight;
return newHeight;
}
} else {
lastHeight = 0;
return 0;
}
}

anchors.bottomMargin: featureFormList.canvasOperationRequested ? featureFormList.height : 0
anchors.rightMargin: featureFormList.canvasOperationRequested ? -featureFormList.width : 0
opacity: featureFormList.canvasOperationRequested ? 0.5 : 1

topPadding: 0
leftPadding: 0
rightPadding: 0
bottomPadding: 0

enabled: !featureFormList.canvasOperationRequested
visible: props.isVisible

states: [
State {
Expand Down Expand Up @@ -255,12 +215,6 @@ Pane {
}
]
state: "Hidden"
clip: true

WheelHandler {
acceptedDevices: PointerDevice.AllDevices
onWheel: {}
}

QtObject {
id: props
Expand Down Expand Up @@ -560,48 +514,15 @@ Pane {
}

onStatusIndicatorDragged: function (deltaX, deltaY) {
fullScreenView = false;
if (isVertical) {
dragHeightAdjustment += deltaY;
} else {
dragWidthAdjustment += deltaX;
}
featureFormList.statusIndicatorDragged(deltaX, deltaY);
}

onStatusIndicatorDragAcquired: {
isDragging = true;
featureFormList.isDragging = true;
}

onStatusIndicatorDragReleased: {
isDragging = false;
if (isVertical) {
const minContentHeight = featureListToolBar.height + 48 + 30;
if (featureFormList.height < minContentHeight) {
if (fullScreenView) {
fullScreenView = false;
} else {
if (featureFormList.state !== 'FeatureFormEdit') {
featureFormList.state = 'Hidden';
}
}
} else if (dragHeightAdjustment < -parent.height * 0.2) {
fullScreenView = true;
}
} else {
if (featureFormList.width < featureFormList.parent.width * 0.3) {
if (fullScreenView) {
fullScreenView = false;
} else {
if (featureFormList.state != 'FeatureFormEdit') {
featureFormList.state = 'Hidden';
}
}
} else if (dragWidthAdjustment < -parent.width * 0.2) {
fullScreenView = true;
}
}
dragHeightAdjustment = 0;
dragWidthAdjustment = 0;
featureFormList.statusIndicatorDragReleased();
}

onEditAttributesButtonClicked: {
Expand Down Expand Up @@ -806,36 +727,6 @@ Pane {
}
}

Behavior on width {
enabled: !isDragging
PropertyAnimation {
duration: parent.width > parent.height ? 250 : 0
easing.type: Easing.OutQuart

onRunningChanged: {
if (running)
mapCanvasMap.freeze('formresize');
else
mapCanvasMap.unfreeze('formresize');
}
}
}

Behavior on height {
enabled: !isDragging
PropertyAnimation {
duration: parent.width < parent.height ? 250 : 0
easing.type: Easing.OutQuart

onRunningChanged: {
if (running)
mapCanvasMap.freeze('formresize');
else
mapCanvasMap.unfreeze('formresize');
}
}
}

Behavior on anchors.rightMargin {
PropertyAnimation {
duration: 250
Expand Down
Loading
Loading