Add options of display position offset
This commit is contained in:
parent
479e3164bb
commit
dc69034125
|
@ -151,6 +151,9 @@
|
||||||
"rightLabel": {
|
"rightLabel": {
|
||||||
"message": "Right"
|
"message": "Right"
|
||||||
},
|
},
|
||||||
|
"positionOffsetLabel": {
|
||||||
|
"message": "Display position - Offset"
|
||||||
|
},
|
||||||
"panelStyleLabel": {
|
"panelStyleLabel": {
|
||||||
"message": "Translation panel"
|
"message": "Translation panel"
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "../styles/TranslateButton.scss";
|
||||||
|
|
||||||
const calcPosition = () => {
|
const calcPosition = () => {
|
||||||
const buttonSize = parseInt(getSettings("buttonSize"));
|
const buttonSize = parseInt(getSettings("buttonSize"));
|
||||||
const offset = 10;
|
const offset = parseInt(getSettings("buttonOffset"));
|
||||||
switch (getSettings("buttonDirection")) {
|
switch (getSettings("buttonDirection")) {
|
||||||
case "top":
|
case "top":
|
||||||
return { top: -buttonSize - offset, left: -buttonSize / 2 };
|
return { top: -buttonSize - offset, left: -buttonSize / 2 };
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default class TranslatePanel extends Component {
|
||||||
const windowWidth = document.documentElement.clientWidth;
|
const windowWidth = document.documentElement.clientWidth;
|
||||||
const windowHeight = document.documentElement.clientHeight;
|
const windowHeight = document.documentElement.clientHeight;
|
||||||
const referencePosition = this.props.position;
|
const referencePosition = this.props.position;
|
||||||
const offset = 10;
|
const offset = parseInt(getSettings("panelOffset"));
|
||||||
|
|
||||||
let position = { x: 0, y: 0 };
|
let position = { x: 0, y: 0 };
|
||||||
const panelDirection = getSettings("panelDirection");
|
const panelDirection = getSettings("panelDirection");
|
||||||
|
|
|
@ -143,7 +143,7 @@ export default [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "buttonDirection",
|
id: "buttonDirection",
|
||||||
title: "buttonPositionLabel",
|
title: "displayDirectionLabel",
|
||||||
captions: [],
|
captions: [],
|
||||||
type: "select",
|
type: "select",
|
||||||
default: "bottomRight",
|
default: "bottomRight",
|
||||||
|
@ -182,6 +182,15 @@ export default [
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
new: true
|
new: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "buttonOffset",
|
||||||
|
title: "positionOffsetLabel",
|
||||||
|
captions: [],
|
||||||
|
type: "number",
|
||||||
|
default: 10,
|
||||||
|
placeholder: 10,
|
||||||
|
new: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -281,6 +290,15 @@ export default [
|
||||||
],
|
],
|
||||||
new: true
|
new: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "panelOffset",
|
||||||
|
title: "positionOffsetLabel",
|
||||||
|
captions: [],
|
||||||
|
type: "number",
|
||||||
|
default: 10,
|
||||||
|
placeholder: 10,
|
||||||
|
new: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "resultFontColor",
|
id: "resultFontColor",
|
||||||
title: "resultFontColorLabel",
|
title: "resultFontColorLabel",
|
||||||
|
|
Loading…
Reference in a new issue