Переглянути джерело

undo for moving with arrow keys

Michael 10 роки тому
батько
коміт
bcc86cdfd2

+ 60 - 0
src/allplatforms/classes/Keyboard.js

@@ -300,6 +300,36 @@ SC.loadPackage({ 'Keyboard': {
                     layout   = SuperGlue.get('document').get('layout');
 
 
+                (function(elements){
+
+                    var savedDimensions = []
+
+                    for(var i = 0, l = elements.length; i < l; i++){
+                        savedDimensions.push({
+                            top:    elements[i].get('top'),
+                            left:   elements[i].get('left'),
+                            width:  elements[i].get('width'),
+                            height: elements[i].get('height')
+                        })
+                    }
+                    
+                    SuperGlue.get('history').do('actionHasStarted', function(){
+                        
+                        for(var i = 0, l = elements.length; i < l; i++){
+                            elements[i].set({
+                                top:    savedDimensions[i].top,
+                                left:   savedDimensions[i].left,
+                                width:  savedDimensions[i].width,
+                                height: savedDimensions[i].height
+                            })
+                        }
+                    
+                    });
+
+                }).call(this, elements);
+
+
+
                 for(var i = 0, l = elements.length; i < l; i++){
 
                     switch(direction){
@@ -331,6 +361,36 @@ SC.loadPackage({ 'Keyboard': {
                 }
 
                 SuperGlue.get('selection').do('updateDimensions');
+
+
+                (function(elements){
+
+                    var savedDimensions = []
+
+                    for(var i = 0, l = elements.length; i < l; i++){
+                        savedDimensions.push({
+                            top:    elements[i].get('top'),
+                            left:   elements[i].get('left'),
+                            width:  elements[i].get('width'),
+                            height: elements[i].get('height')
+                        })
+                    }
+                    
+                    SuperGlue.get('history').do('actionHasSucceeded', function(){
+                        
+                        for(var i = 0, l = elements.length; i < l; i++){
+                            elements[i].set({
+                                top:    savedDimensions[i].top,
+                                left:   savedDimensions[i].left,
+                                width:  savedDimensions[i].width,
+                                height: savedDimensions[i].height
+                            })
+                        }
+                    
+                    });
+
+                }).call(this, elements);
+
                 
             }
         }

+ 1 - 2
src/allplatforms/classes/Selection.js

@@ -571,7 +571,7 @@ SC.loadPackage({ 'Selection': {
                             document.addEventListener('mousemove', onMouseMove, true);
                             document.addEventListener('mouseup',   onMouseUp,   true);
                             SuperGlue.get('document').set({ interactionInProgress: true });
-                            // UNDO
+                            
 
                         }
 
@@ -587,7 +587,6 @@ SC.loadPackage({ 'Selection': {
                         document.removeEventListener('mouseup', onMouseUpWithModifier, true);
                         SuperGlue.get('document').set({ interactionInProgress: false });
                         
-                        // UNDO
                         
                         evt.stopPropagation();
                         evt.preventDefault();

+ 2 - 1
src/allplatforms/classes/WidgetCopy.js

@@ -19,10 +19,11 @@ SC.loadPackage({ 'WidgetCopy': {
                 this.delegate('Widget', 'init', theSelection);
                 this.set({ isActionButton: true });
 
+                var self = this;
 
                 this.get('widgetButton').addEventListener('mouseup', function(){
 
-                    self.do('action')
+                    self.do('action');
 
                 }, false)
 

BIN
src/chromium/logo-128.png


BIN
src/chromium/logo-16.png


BIN
src/chromium/logo-48.png


+ 12 - 5
src/chromium/manifest.json

@@ -2,12 +2,19 @@
   
     "manifest_version": 2,
 
-    "name": "SuperGlue",
-    "description": "This is the SuperGlue Plugin to create and modify web content stored on a SuperGlue server",
-    "author": "The SuperGlue Team (2014). www.superglue.it",
-    "version": "1.0",
+    "name":         "SuperGlue",
+    "description":  "This is the SuperGlue browser add-on to create and modify web content stored on a SuperGlue server",
+    "author":       "The SuperGlue Team (2014). www.superglue.it",
+    "version":      "1.0",
+
+    "icons": {  
+        "16":  "logo-16.png",
+        "48":  "logo-48.png",
+        "128": "logo-128.png" 
+    },
+
 
-    "permissions": [ "tabs", "activeTab", "<all_urls>", "clipboardRead", "clipboardWrite" ],
+    "permissions":  [ "tabs", "activeTab", "<all_urls>", "clipboardRead", "clipboardWrite" ],
 
     "web_accessible_resources": [ "*" ],
 

BIN
src/firefox/data/logo-32.png


BIN
src/firefox/data/logo-64.png


+ 9 - 7
src/firefox/package.json

@@ -1,9 +1,11 @@
 {
-  "name": "superglue",
-  "title": "SuperGlue",
-  "id": "jid1-C1BbtcqPveDNXw",
-  "description": "This is the SuperGlue Plugin to create and modify web content stored on a SuperGlue server",
-  "author": "The SuperGlue Team (2014). www.superglue.it",
-  "license": "GPL",
-  "version": "1.0"
+  "name":         "superglue",
+  "title":        "SuperGlue",
+  "id":           "jid1-C1BbtcqPveDNXw",
+  "description":  "This is the SuperGlue browser add-on to create and modify web content stored on a SuperGlue server",
+  "author":       "The SuperGlue Team (2014). www.superglue.it",
+  "license":      "GPL",
+  "version":      "1.0",
+  "icon":         "data/logo-32.png",
+  "icon64":       "data/logo-64.png"
 }