Add options of display position offset

This commit is contained in:
sienori 2019-02-23 17:42:46 +09:00
parent 479e3164bb
commit dc69034125
4 changed files with 24 additions and 3 deletions

View file

@ -151,6 +151,9 @@
"rightLabel": {
"message": "Right"
},
"positionOffsetLabel": {
"message": "Display position - Offset"
},
"panelStyleLabel": {
"message": "Translation panel"
},

View file

@ -4,7 +4,7 @@ import "../styles/TranslateButton.scss";
const calcPosition = () => {
const buttonSize = parseInt(getSettings("buttonSize"));
const offset = 10;
const offset = parseInt(getSettings("buttonOffset"));
switch (getSettings("buttonDirection")) {
case "top":
return { top: -buttonSize - offset, left: -buttonSize / 2 };

View file

@ -31,7 +31,7 @@ export default class TranslatePanel extends Component {
const windowWidth = document.documentElement.clientWidth;
const windowHeight = document.documentElement.clientHeight;
const referencePosition = this.props.position;
const offset = 10;
const offset = parseInt(getSettings("panelOffset"));
let position = { x: 0, y: 0 };
const panelDirection = getSettings("panelDirection");

View file

@ -143,7 +143,7 @@ export default [
},
{
id: "buttonDirection",
title: "buttonPositionLabel",
title: "displayDirectionLabel",
captions: [],
type: "select",
default: "bottomRight",
@ -182,6 +182,15 @@ export default [
}
],
new: true
},
{
id: "buttonOffset",
title: "positionOffsetLabel",
captions: [],
type: "number",
default: 10,
placeholder: 10,
new: true
}
]
},
@ -281,6 +290,15 @@ export default [
],
new: true
},
{
id: "panelOffset",
title: "positionOffsetLabel",
captions: [],
type: "number",
default: 10,
placeholder: 10,
new: true
},
{
id: "resultFontColor",
title: "resultFontColorLabel",