File tree Expand file tree Collapse file tree
packages/map/src/geometry Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1476,7 +1476,7 @@ class GeometryEditor extends Eventable(Class) {
14761476 * @return {Object } map view
14771477 */
14781478 undo ( ) : any {
1479- if ( ! this . _history || this . _historyPointer === 0 ) {
1479+ if ( this . _isundoEdit ( ) ) {
14801480 return this ;
14811481 }
14821482 const record = this . _history [ -- this . _historyPointer ] ;
@@ -1491,7 +1491,7 @@ class GeometryEditor extends Eventable(Class) {
14911491 * @return {Object } map view
14921492 */
14931493 redo ( ) : any {
1494- if ( ! this . _history || this . _historyPointer === this . _history . length - 1 ) {
1494+ if ( this . _isRedoEdit ( ) ) {
14951495 return this ;
14961496 }
14971497 const record = this . _history [ ++ this . _historyPointer ] ;
@@ -1549,6 +1549,18 @@ class GeometryEditor extends Eventable(Class) {
15491549 }
15501550 this . _updating = updating ;
15511551 }
1552+ _isRedoEdit ( ) : boolean {
1553+ if ( ! this . _history || this . _historyPointer === this . _history . length - 1 ) {
1554+ return true ;
1555+ }
1556+ return false ;
1557+ }
1558+ _isundoEdit ( ) : boolean {
1559+ if ( ! this . _history || this . _historyPointer === 0 ) {
1560+ return true ;
1561+ }
1562+ return false ;
1563+ }
15521564
15531565}
15541566
Original file line number Diff line number Diff line change @@ -195,5 +195,27 @@ Geometry.include(/** @lends Geometry.prototype */ {
195195 return this . _editor . isEditing ( ) ;
196196 }
197197 return false ;
198+ } ,
199+ /**
200+ * 编辑是否已经全部撤回
201+ * @english
202+ * Whether the geometry is being edited.
203+ * @return {boolean }
204+ */
205+ undoEditcheck ( ) : boolean {
206+ if ( this . isEditing ( ) ) {
207+ return this . _editor . _isundoEdit ( ) ;
208+ }
209+ } ,
210+ /**
211+ * 编辑是否已经全部重做
212+ * @english
213+ * Whether the geometry is being edited.
214+ * @return {boolean }
215+ */
216+ redoEditcheck ( ) : boolean {
217+ if ( this . isEditing ( ) ) {
218+ return this . _editor . _isRedoEdit ( ) ;
219+ }
198220 }
199221} ) ;
You can’t perform that action at this time.
0 commit comments