diff src/djol/_OneshotTool.js @ 34:27e8e9e38e07 default tip

Слияние
author nickolay
date Wed, 05 Jun 2019 20:44:15 +0300
parents 8af8e840dd49 1dc2fd263b90
children
line wrap: on
line diff
--- a/src/djol/_OneshotTool.js	Wed Jun 05 17:44:17 2019 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-define(["dojo/_base/declare", "implab/safe", "implab/guard", "ol3/_ToolBase", "ol3/ToolType"],
-
-    function (declare, safe, guard, _ToolBase, ToolType) {
-        return declare([_ToolBase], {
-            _pending: null,
-
-            _lastResult: null,
-
-            toolType: ToolType.Oneshot,
-
-            invoke: function () {
-            },
-
-            onActivating: function () {
-                var me = this;
-
-                // start the operation
-                me._lastResult = me._pending = guard(me, "invoke");
-
-                return this.inherited(arguments);
-            },
-
-            onActivated: function () {
-                var me = this;
-
-                // fire the activate event
-                this.inherited(arguments);
-
-                me._pending.then(function () {
-                    if (me._pending) {
-                        me.log("Operation finished, deactivating.");
-                        me._pending = null;
-                        me.deactivate();
-                    }
-                }, function (ex) {
-                    if (me._pending) {
-                        me.error("Operation failed, deactivating: {0}", ex);
-                        me._pending = null;
-                        me.deactivate();
-                    }
-                });
-            },
-
-            onDeactivated: function () {
-                var d = this._pending;
-                if (d) {
-                    this.log("Cancelling pending operation");
-                    this._pending = null;
-                    d.cancel();
-                }
-
-                return this.inherited(arguments);
-            },
-
-            run: function () {
-                var me = this;
-
-                return me.activate().then(function () {
-                    return me._lastResult;
-                });
-            }
-        });
-    });
\ No newline at end of file