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

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

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