Коммит e00639c0 создал по автору avathar's avatar avathar
Просмотр файлов

#174 размеры шрифтов вынесены в набор констант

владелец 5202e643
......@@ -5,6 +5,8 @@ import {
COLOR_DARK,
DefaultDepth,
DragObjectDepth,
FONT_SMALL,
FONT_LARGE,
} from '../kanbans/Const';
import { ItemType } from 'src/types/kanban_types';
import { EventBus, Events } from 'src/boot/eventBus';
......@@ -25,10 +27,10 @@ const CreateItem = (scene: EndlessCanvas, card: ObjectWrapper) => {
color: COLOR_PRIMARY,
}),
text: scene.add.text(0, 0, card.name, {
fontSize: 18,
fontSize: FONT_SMALL,
}),
// action: createIcon(),
actionSize: 24,
actionSize: parseInt(FONT_LARGE),
align: 'left',
space: {
left: 5,
......@@ -43,9 +45,7 @@ const CreateItem = (scene: EndlessCanvas, card: ObjectWrapper) => {
{
label: 'Редактировать карточку',
id: 0,
onClick: () => {
console.log('Редактировать карточку');
createModal(
scene,
(text) => {
......@@ -71,7 +71,6 @@ const CreateItem = (scene: EndlessCanvas, card: ObjectWrapper) => {
label: 'Удалить карточку',
id: 1,
onClick: () => {
console.log('Удалить карточку');
createModal(
scene,
null,
......@@ -94,7 +93,7 @@ const CreateItem = (scene: EndlessCanvas, card: ObjectWrapper) => {
},
];
const dropDownButton = CreateDropDownList(scene, card, optionsArr);
const dropDownButton = CreateDropDownList(scene, optionsArr);
dropDownButton.setPosition(item.width - dropDownButton.width, 0);
item.add(dropDownButton);
......@@ -131,8 +130,6 @@ const OnItemDragStart = function (this): void {
const OnItemDragEnd = function (this): void {
this.setDepth(DefaultDepth);
this.getElement('background').setStrokeStyle();
// console.log(this);
// console.log(this.getParentSizer());
};
export default CreateItem;
......@@ -6,3 +6,9 @@ export const COLOR_DARK = 0x260e04;
// Depth
export const DragObjectDepth = 1000;
export const DefaultDepth = 0;
//Font Size
export const FONT_SMALL = '18px';
export const FONT_ORDINARY = '20px';
export const FONT_LARGE = '24px';
export const FONT_HUGE = '32px';
import ObjectWrapper from 'src/utils/objectWrapper';
import { COLOR_LIGHT, COLOR_PRIMARY, COLOR_DARK } from './Const';
import {
COLOR_LIGHT,
COLOR_PRIMARY,
COLOR_DARK,
FONT_SMALL,
FONT_LARGE,
} from './Const';
import { DefaultDepth, DragObjectDepth } from './Const';
import CreateItemsBox from '../cards/CreateItemsBox';
import { EndlessCanvas } from '../spaces-2d/EndlessCanvas';
......@@ -44,11 +50,11 @@ const CreateTitle = (scene: EndlessCanvas, column: ObjectWrapper, callback) => {
color: COLOR_LIGHT,
}),
text: scene.add.text(0, 0, column.name || '', {
fontSize: 18,
fontSize: FONT_SMALL,
}),
align: 'left',
//action: dropDownButton,
actionSize: 24,
actionSize: parseInt(FONT_LARGE),
space: {
left: 5,
right: 5,
......@@ -63,14 +69,9 @@ const CreateTitle = (scene: EndlessCanvas, column: ObjectWrapper, callback) => {
label: 'Добавить карточку',
id: 0,
onClick: () => {
console.log('Добавить карточку');
createModal(
scene,
(text) => {
textInput = text;
},
'',
).then((button) => {
createModal(scene, (text) => {
textInput = text;
}).then((button) => {
//@ts-ignore
if (button.text === 'Сохранить') {
if (textInput) {
......@@ -94,7 +95,6 @@ const CreateTitle = (scene: EndlessCanvas, column: ObjectWrapper, callback) => {
label: 'Переименовать столбец',
id: 1,
onClick: () => {
console.log('Переименовать столбец');
createModal(
scene,
(text) => {
......@@ -121,7 +121,6 @@ const CreateTitle = (scene: EndlessCanvas, column: ObjectWrapper, callback) => {
label: 'Удалить столбец',
id: 2,
onClick: () => {
console.log('Удалить столбец');
createModal(
scene,
null,
......@@ -143,7 +142,7 @@ const CreateTitle = (scene: EndlessCanvas, column: ObjectWrapper, callback) => {
},
},
];
const dropDownButton = CreateDropDownList(scene, column, dropDownOptions);
const dropDownButton = CreateDropDownList(scene, dropDownOptions);
dropDownButton.setPosition(title.width - dropDownButton.width, 0);
title.add(dropDownButton);
......
......@@ -3,7 +3,6 @@ import GetMaxTextObjectSize from './GetMaxTextObjectSize';
import CreateTextObject from './CreateTextObject';
import CreatePopupList from './CreatePopupList';
import { EndlessCanvas } from '../spaces-2d/EndlessCanvas';
import ObjectWrapper from 'src/utils/objectWrapper';
type Options = {
id: number;
label: string;
......@@ -11,7 +10,6 @@ type Options = {
};
const CreateDropDownList = function (
scene: EndlessCanvas,
board: ObjectWrapper,
optionsArr?: Options[],
labelText: string = '...',
) {
......@@ -20,25 +18,20 @@ const CreateDropDownList = function (
optionsArr.map((o) => o.label),
);
const labelMaxTextSize = GetMaxTextObjectSize(scene, [labelText]);
const label = scene.rexUI.add
.label({
background: scene.rexUI.add
.roundRectangle(0, 0, 2, 2, 0, COLOR_PRIMARY)
.setAlpha(0),
text: CreateTextObject(scene, labelText),
// .setFixedSize(
// maxTextSize.width,
// maxTextSize.height,
// )
space: {
left: 10,
right: 10,
top: 10,
bottom: 10,
icon: 10,
},
})
.setData('value', '');
const label = scene.rexUI.add.label({
background: scene.rexUI.add
.roundRectangle(0, 0, 2, 2, 0, COLOR_PRIMARY)
.setAlpha(0),
text: CreateTextObject(scene, labelText),
space: {
left: 10,
right: 10,
top: 10,
bottom: 10,
icon: 10,
},
});
// .setData('value', '');
let menu;
......@@ -50,7 +43,6 @@ const CreateDropDownList = function (
const menuY = label.bottom;
menu = CreatePopupList(
scene,
board,
menuX - maxTextSize.width + labelMaxTextSize.width / 2,
menuY,
optionsArr,
......
......@@ -28,14 +28,9 @@ const CreateHeader = function (scene: EndlessCanvas, board: ObjectWrapper) {
label: 'Добавить столбец',
id: 0,
onClick: () => {
console.log('Добавить столбец');
createModal(
scene,
function (text) {
textInput = text;
},
'',
).then((button) => {
createModal(scene, function (text) {
textInput = text;
}).then((button) => {
//@ts-ignore
if (button.text === 'Сохранить') {
if (textInput) {
......@@ -59,7 +54,6 @@ const CreateHeader = function (scene: EndlessCanvas, board: ObjectWrapper) {
label: 'Переименовать доску',
id: 1,
onClick: () => {
console.log('Переименовать доску');
createModal(
scene,
function (text) {
......@@ -86,7 +80,6 @@ const CreateHeader = function (scene: EndlessCanvas, board: ObjectWrapper) {
label: 'Удалить доску',
id: 2,
onClick: () => {
console.log('Удалить доску');
createModal(
scene,
null,
......@@ -108,7 +101,7 @@ const CreateHeader = function (scene: EndlessCanvas, board: ObjectWrapper) {
},
},
];
const dropDownButton = CreateDropDownList(scene, board, dropDownOptions);
const dropDownButton = CreateDropDownList(scene, dropDownOptions);
sizer
.add(headerLabel, { proportion: 1, expand: true })
......
import { EndlessCanvas } from '../spaces-2d/EndlessCanvas';
import { FONT_SMALL } from './Const';
const CreateModalLabel = (scene: EndlessCanvas, text: string) => {
const normalBackground = scene.rexUI.add.roundRectangle(
......@@ -27,7 +28,7 @@ const CreateModalLabel = (scene: EndlessCanvas, text: string) => {
.label({
background: normalBackground,
text: scene.add.text(0, 0, text, {
fontSize: 18,
fontSize: FONT_SMALL,
color: '#000000', // Чёрный текст
}),
align: 'center',
......
import { COLOR_LIGHT, COLOR_PRIMARY, COLOR_DARK } from './Const';
import CreateTextObject from './CreateTextObject';
import ObjectWrapper from 'src/utils/objectWrapper';
import { EndlessCanvas } from '../spaces-2d/EndlessCanvas';
type Options = {
id: number;
......@@ -9,7 +8,6 @@ type Options = {
};
const CreatePopupList = function (
scene: EndlessCanvas,
board: ObjectWrapper,
x: number,
y: number,
options: Options[],
......
import { EndlessCanvas } from '../spaces-2d/EndlessCanvas';
import { COLOR_LIGHT, COLOR_PRIMARY, COLOR_DARK } from './Const';
import {
COLOR_LIGHT,
COLOR_PRIMARY,
COLOR_DARK,
FONT_ORDINARY,
FONT_LARGE,
} from './Const';
const CreateRequestModal = (
scene: EndlessCanvas,
......@@ -33,7 +39,7 @@ const CreateRequestModal = (
},
style: {
fontSize: 20,
fontSize: FONT_ORDINARY,
//@ts-ignore
backgroundBottomY: 1,
backgroundHeight: 20,
......@@ -72,7 +78,7 @@ const CreateRequestModal = (
const cancelButton = scene.rexUI.add
.label({
background: scene.rexUI.add.roundRectangle(0, 0, 0, 0, 20, COLOR_DARK),
text: scene.add.text(0, 0, cancelButtonText, { fontSize: '24px' }),
text: scene.add.text(0, 0, cancelButtonText, { fontSize: FONT_LARGE }),
space: { left: 10, right: 10, top: 10, bottom: 10 },
})
.setDepth(3);
......@@ -80,7 +86,7 @@ const CreateRequestModal = (
const confirmButton = scene.rexUI.add
.label({
background: scene.rexUI.add.roundRectangle(0, 0, 0, 0, 20, COLOR_LIGHT),
text: scene.add.text(0, 0, confirmButtonText, { fontSize: '24px' }),
text: scene.add.text(0, 0, confirmButtonText, { fontSize: FONT_LARGE }),
space: { left: 10, right: 10, top: 10, bottom: 10 },
})
......@@ -94,7 +100,7 @@ const CreateRequestModal = (
title: scene.rexUI.add.label({
text: scene.add.text(0, 0, titleText, {
fontSize: '24px',
fontSize: FONT_LARGE,
color: '#000000',
}),
space: {
......
import { EndlessCanvas } from '../spaces-2d/EndlessCanvas';
const CreateTextObject = function (scene: EndlessCanvas, text: string): any {
const CreateTextObject = function (
scene: EndlessCanvas,
text: string,
fontSize: string = '20px',
): any {
return scene.add.text(0, 0, text, {
fontSize: '20px',
fontSize,
});
};
export default CreateTextObject;
......@@ -5,10 +5,12 @@ import CreateTextObject from './CreateTextObject';
const GetMaxTextObjectSize = function (
scene: EndlessCanvas,
contentArray: string[],
fontSize?: string,
): { width: number; height: number } {
const textObject = CreateTextObject(
scene,
'',
fontSize,
) as unknown as Phaser.GameObjects.Text;
let width = 0,
height = 0;
......
import { FONT_SMALL } from '../kanbans/Const';
import { EndlessCanvas } from './EndlessCanvas';
export default (scene: EndlessCanvas) => {
const ZOOM_MAX = 2;
......@@ -42,7 +43,7 @@ export default (scene: EndlessCanvas) => {
scene.cameras.main.width - 190,
scene.cameras.main.height - 38,
`${(scene.cameras.main.zoom * 100).toFixed(0)}%`,
{ fontSize: 18, color: '#000' },
{ fontSize: FONT_SMALL, color: '#000' },
);
const zoomPlusButton = createZoomButton(
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать