mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
redux: fixed bugs
This commit is contained in:
parent
0f3217f5df
commit
5d14a753f7
6 changed files with 20 additions and 31 deletions
|
@ -11,10 +11,10 @@ type Props = {
|
||||||
|
|
||||||
export class CancelDialog extends React.Component<Props, void> {
|
export class CancelDialog extends React.Component<Props, void> {
|
||||||
cancel = () => {
|
cancel = () => {
|
||||||
editor.cancelEditing();
|
this.props.stopEditing();
|
||||||
// this.props.stopEditing();
|
// editor.cancelEditing();
|
||||||
this.props.setEditing(false);
|
// this.props.setEditing(false);
|
||||||
this.props.setMode(MODES.NONE);
|
// this.props.setMode(MODES.NONE);
|
||||||
};
|
};
|
||||||
|
|
||||||
proceed = () => {
|
proceed = () => {
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
transition: opacity 1s;
|
transition: opacity 1s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
|
|
||||||
|
|
||||||
import { App } from '$containers/App';
|
import { App } from '$containers/App';
|
||||||
import '$styles/main.less';
|
import '$styles/main.less';
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,6 @@ export class Editor {
|
||||||
};
|
};
|
||||||
|
|
||||||
startEditing = () => {
|
startEditing = () => {
|
||||||
console.log('ED START');
|
|
||||||
const { path } = getUrlData();
|
const { path } = getUrlData();
|
||||||
const { random_url, id } = this.getUser();
|
const { random_url, id } = this.getUser();
|
||||||
|
|
||||||
|
@ -257,13 +256,9 @@ export class Editor {
|
||||||
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();
|
||||||
|
|
||||||
// this.setEditing(true);
|
|
||||||
// console.log(this.initialData);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
stopEditing = () => {
|
stopEditing = () => {
|
||||||
console.log('ED STOP');
|
|
||||||
const { path } = getUrlData();
|
const { path } = getUrlData();
|
||||||
pushPath(`/${(this.initialData && this.initialData.path) || path}`);
|
pushPath(`/${(this.initialData && this.initialData.path) || path}`);
|
||||||
|
|
||||||
|
@ -274,20 +269,14 @@ export class Editor {
|
||||||
};
|
};
|
||||||
|
|
||||||
cancelEditing = () => {
|
cancelEditing = () => {
|
||||||
this.stopEditing();
|
|
||||||
|
|
||||||
console.log('trying to set initial data');
|
|
||||||
|
|
||||||
if (this.hasEmptyHistory()) {
|
if (this.hasEmptyHistory()) {
|
||||||
console.log('empty history');
|
|
||||||
this.clearAll();
|
this.clearAll();
|
||||||
this.startEditing();
|
this.startEditing();
|
||||||
} else {
|
} else {
|
||||||
console.log('setting initial');
|
|
||||||
this.setData(this.initialData);
|
this.setData(this.initialData);
|
||||||
console.log('setting initial - done');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.stopEditing();
|
||||||
this.clearChanged();
|
this.clearChanged();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -57,9 +57,9 @@ export class Stickers {
|
||||||
|
|
||||||
startEditing = () => {
|
startEditing = () => {
|
||||||
this.stickers.map(sticker => sticker.startEditing());
|
this.stickers.map(sticker => sticker.startEditing());
|
||||||
}
|
};
|
||||||
|
|
||||||
stopEditing = () => {
|
stopEditing = () => {
|
||||||
this.stickers.map(sticker => sticker.stopEditing());
|
this.stickers.map(sticker => sticker.stopEditing());
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,16 +48,14 @@ function* stopEditingSaga() {
|
||||||
const { changed, editing, mode } = yield select(getState);
|
const { changed, editing, mode } = yield select(getState);
|
||||||
|
|
||||||
if (!editing) return;
|
if (!editing) return;
|
||||||
|
if (changed && mode !== MODES.CONFIRM_CANCEL) {
|
||||||
if (!changed) {
|
|
||||||
yield editor.cancelEditing();
|
|
||||||
yield put(setEditing(false));
|
|
||||||
yield put(setMode(MODES.NONE));
|
|
||||||
} else {
|
|
||||||
// editor.changeMode(MODES.CONFIRM_CANCEL);
|
|
||||||
// this.props.setMode(MODES.CONFIRM_CANCEL);
|
|
||||||
yield put(setMode(MODES.CONFIRM_CANCEL));
|
yield put(setMode(MODES.CONFIRM_CANCEL));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
yield editor.cancelEditing();
|
||||||
|
yield put(setEditing(false));
|
||||||
|
yield put(setMode(MODES.NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
function* mapInitSaga() {
|
function* mapInitSaga() {
|
||||||
|
@ -67,8 +65,6 @@ function* mapInitSaga() {
|
||||||
const map = yield call(getStoredMap, { name: path });
|
const map = yield call(getStoredMap, { name: path });
|
||||||
|
|
||||||
if (map) {
|
if (map) {
|
||||||
console.log('setting!', map, mode);
|
|
||||||
|
|
||||||
yield editor.setData(map);
|
yield editor.setData(map);
|
||||||
yield put(setChanged(false));
|
yield put(setChanged(false));
|
||||||
|
|
||||||
|
@ -77,10 +73,9 @@ function* mapInitSaga() {
|
||||||
// yield put(setEditing(true));
|
// yield put(setEditing(true));
|
||||||
// editor.startEditing();
|
// editor.startEditing();
|
||||||
} else {
|
} else {
|
||||||
console.log('stopping edit');
|
|
||||||
yield put(setEditing(false));
|
yield put(setEditing(false));
|
||||||
// yield call(stopEditingSaga);
|
// yield call(stopEditingSaga);
|
||||||
// editor.stopEditing();
|
editor.stopEditing();
|
||||||
}
|
}
|
||||||
|
|
||||||
return hideLoader();
|
return hideLoader();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue