Loading editor/qml/PropertyPanel.qml +27 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,24 @@ ColumnLayout { ListModel { id: surveyListModel } Connections { target: localApi function onMediaDimensionsReady(mediaId, width, height) { if (!propPanel.currentUuid || currentProps["media_id"] !== mediaId) return var props = {} if (parseInt(currentProps["real_width"] || "0") <= 0 && width > 0) { props["real_width"] = String(width) } if (parseInt(currentProps["real_height"] || "0") <= 0 && height > 0) { props["real_height"] = String(height) } if (Object.keys(props).length > 0) { propPanel.saveProperties(props) propPanel.loadProperties(propPanel.currentUuid) } } } function loadProperties(uuid) { currentUuid = uuid var json = localApi.getElementProperties(uuid) Loading @@ -39,6 +57,15 @@ ColumnLayout { cp[key] = value currentProps = cp root.setStatus("Saved") // Auto-calculate missing image dimension from aspect ratio if ((key === "real_width" || key === "real_height") && currentProps["media_id"]) { var rw = (key === "real_width") ? parseInt(value) : parseInt(currentProps["real_width"] || "0") var rh = (key === "real_height") ? parseInt(value) : parseInt(currentProps["real_height"] || "0") if ((rw > 0 && rh <= 0) || (rh > 0 && rw <= 0)) { localApi.calcMediaDimensions(currentProps["media_id"], rw, rh) } } } function saveProperties(propsObj) { Loading Loading
editor/qml/PropertyPanel.qml +27 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,24 @@ ColumnLayout { ListModel { id: surveyListModel } Connections { target: localApi function onMediaDimensionsReady(mediaId, width, height) { if (!propPanel.currentUuid || currentProps["media_id"] !== mediaId) return var props = {} if (parseInt(currentProps["real_width"] || "0") <= 0 && width > 0) { props["real_width"] = String(width) } if (parseInt(currentProps["real_height"] || "0") <= 0 && height > 0) { props["real_height"] = String(height) } if (Object.keys(props).length > 0) { propPanel.saveProperties(props) propPanel.loadProperties(propPanel.currentUuid) } } } function loadProperties(uuid) { currentUuid = uuid var json = localApi.getElementProperties(uuid) Loading @@ -39,6 +57,15 @@ ColumnLayout { cp[key] = value currentProps = cp root.setStatus("Saved") // Auto-calculate missing image dimension from aspect ratio if ((key === "real_width" || key === "real_height") && currentProps["media_id"]) { var rw = (key === "real_width") ? parseInt(value) : parseInt(currentProps["real_width"] || "0") var rh = (key === "real_height") ? parseInt(value) : parseInt(currentProps["real_height"] || "0") if ((rw > 0 && rh <= 0) || (rh > 0 && rw <= 0)) { localApi.calcMediaDimensions(currentProps["media_id"], rw, rh) } } } function saveProperties(propsObj) { Loading