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": { "rightLabel": {
"message": "Right" "message": "Right"
}, },
"positionOffsetLabel": {
"message": "Display position - Offset"
},
"panelStyleLabel": { "panelStyleLabel": {
"message": "Translation panel" "message": "Translation panel"
}, },

View file

@ -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 };

View file

@ -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");

View file

@ -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",