mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
stickers: separated stickers and stickers_select modes
This commit is contained in:
parent
dde58461b7
commit
e53ef85ae9
5 changed files with 10 additions and 22 deletions
|
@ -37,7 +37,7 @@ type Props = {
|
||||||
|
|
||||||
const DIALOG_CONTENTS = {
|
const DIALOG_CONTENTS = {
|
||||||
[MODES.ROUTER]: RouterDialog,
|
[MODES.ROUTER]: RouterDialog,
|
||||||
[MODES.STICKERS]: StickersDialog,
|
[MODES.STICKERS_SELECT]: StickersDialog,
|
||||||
[MODES.TRASH]: TrashDialog,
|
[MODES.TRASH]: TrashDialog,
|
||||||
[MODES.LOGO]: LogoDialog,
|
[MODES.LOGO]: LogoDialog,
|
||||||
[MODES.SAVE]: SaveDialog,
|
[MODES.SAVE]: SaveDialog,
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Component extends React.PureComponent<Props, void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
startPolyMode = () => this.props.setMode(MODES.POLY);
|
startPolyMode = () => this.props.setMode(MODES.POLY);
|
||||||
startStickerMode = () => this.props.setMode(MODES.STICKERS);
|
startStickerMode = () => this.props.setMode(MODES.STICKERS_SELECT);
|
||||||
startRouterMode = () => this.props.setMode(MODES.ROUTER);
|
startRouterMode = () => this.props.setMode(MODES.ROUTER);
|
||||||
startProviderMode = () => this.props.setMode(MODES.PROVIDER);
|
startProviderMode = () => this.props.setMode(MODES.PROVIDER);
|
||||||
startTrashMode = () => this.props.setMode(MODES.TRASH);
|
startTrashMode = () => this.props.setMode(MODES.TRASH);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
export const MODES = ({
|
export const MODES = ({
|
||||||
POLY: 'POLY',
|
POLY: 'POLY',
|
||||||
STICKERS: 'STICKERS',
|
STICKERS: 'STICKERS',
|
||||||
|
STICKERS_SELECT: 'STICKERS_SELECT',
|
||||||
ROUTER: 'ROUTER',
|
ROUTER: 'ROUTER',
|
||||||
SHOTTER: 'SHOTTER',
|
SHOTTER: 'SHOTTER',
|
||||||
TRASH: 'TRASH',
|
TRASH: 'TRASH',
|
||||||
|
|
|
@ -59,6 +59,9 @@ export class Editor {
|
||||||
[MODES.STICKERS]: {
|
[MODES.STICKERS]: {
|
||||||
toggle: this.clearSticker,
|
toggle: this.clearSticker,
|
||||||
},
|
},
|
||||||
|
[MODES.STICKERS_SELECT]: {
|
||||||
|
toggle: this.clearSticker,
|
||||||
|
},
|
||||||
[MODES.TRASH]: {
|
[MODES.TRASH]: {
|
||||||
// toggle: this.clearAll,
|
// toggle: this.clearAll,
|
||||||
toggle: this.clearMode,
|
toggle: this.clearMode,
|
||||||
|
@ -143,6 +146,7 @@ export class Editor {
|
||||||
this.stickers.createSticker({ latlng, sticker: this.activeSticker.sticker, set: this.activeSticker.set });
|
this.stickers.createSticker({ latlng, sticker: this.activeSticker.sticker, set: this.activeSticker.set });
|
||||||
this.setActiveSticker(null);
|
this.setActiveSticker(null);
|
||||||
this.setChanged(true);
|
this.setChanged(true);
|
||||||
|
this.setMode(MODES.STICKERS_SELECT);
|
||||||
};
|
};
|
||||||
|
|
||||||
changeMode = mode => {
|
changeMode = mode => {
|
||||||
|
@ -240,8 +244,6 @@ export class Editor {
|
||||||
sticker.set && STICKERS[sticker.set].url &&
|
sticker.set && STICKERS[sticker.set].url &&
|
||||||
this.stickers.createSticker({
|
this.stickers.createSticker({
|
||||||
latlng: sticker.latlng,
|
latlng: sticker.latlng,
|
||||||
// angle: parseStickerAngle({ sticker, version }),
|
|
||||||
// sticker: parseStickerStyle({ sticker, version }),
|
|
||||||
angle: sticker.angle,
|
angle: sticker.angle,
|
||||||
sticker: sticker.sticker,
|
sticker: sticker.sticker,
|
||||||
set: sticker.set,
|
set: sticker.set,
|
||||||
|
@ -280,27 +282,16 @@ export class Editor {
|
||||||
};
|
};
|
||||||
|
|
||||||
startEditing = () => {
|
startEditing = () => {
|
||||||
const { path } = getUrlData();
|
const { id } = this.getUser();
|
||||||
const { random_url, id } = this.getUser();
|
|
||||||
|
|
||||||
this.setInitialData();
|
this.setInitialData();
|
||||||
|
|
||||||
// const url = (this.owner && this.owner.id === id) ? path : random_url;
|
|
||||||
this.owner = { id };
|
this.owner = { id };
|
||||||
|
|
||||||
// console.log('PATH IS', path);
|
|
||||||
// pushPath(`/${url}/edit`);
|
|
||||||
|
|
||||||
if (this.poly.latlngs && this.poly.latlngs.length > 1) this.poly.poly.enableEdit();
|
if (this.poly.latlngs && this.poly.latlngs.length > 1) this.poly.poly.enableEdit();
|
||||||
this.stickers.startEditing();
|
this.stickers.startEditing();
|
||||||
};
|
};
|
||||||
|
|
||||||
stopEditing = () => {
|
stopEditing = () => {
|
||||||
// const { path } = getUrlData();
|
|
||||||
|
|
||||||
// console.log('PATH IS', path, this.initialData.path);
|
|
||||||
// pushPath(`/${(this.initialData && this.initialData.path) || path}`);
|
|
||||||
|
|
||||||
this.poly.poly.disableEdit();
|
this.poly.poly.disableEdit();
|
||||||
this.stickers.stopEditing();
|
this.stickers.stopEditing();
|
||||||
};
|
};
|
||||||
|
|
|
@ -201,18 +201,14 @@ function* setModeSaga({ mode }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function* userLogoutSaga() {
|
function* userLogoutSaga() {
|
||||||
const { id } = yield select(getUser);
|
|
||||||
|
|
||||||
// if (id === editor.owner) {
|
|
||||||
// editor.owner = { id: null };
|
|
||||||
// }
|
|
||||||
|
|
||||||
yield put(setUser(DEFAULT_USER));
|
yield put(setUser(DEFAULT_USER));
|
||||||
yield call(generateGuestSaga);
|
yield call(generateGuestSaga);
|
||||||
}
|
}
|
||||||
|
|
||||||
function* setActiveStickerSaga({ activeSticker }) {
|
function* setActiveStickerSaga({ activeSticker }) {
|
||||||
yield editor.activeSticker = activeSticker;
|
yield editor.activeSticker = activeSticker;
|
||||||
|
yield put(setMode(MODES.STICKERS));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue