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