Permalink
Browse files

Break clipboard out for some dumb reason, fix canvas following mouse …

…on page scroll
  • Loading branch information...
1 parent 01e5157 commit e0dd98dbf36f94f3a44de390b1cf53c43564838f @chrisbarmonde committed Feb 22, 2012
Showing with 26 additions and 17 deletions.
  1. +1 −0 manifest.json
  2. +12 −0 src/clipboard.js
  3. +11 −1 src/content_script.js
  4. +2 −2 src/particleengine.js
  5. +0 −14 src/util.js
View
@@ -21,6 +21,7 @@
"src/lib/jquery.min.js",
"src/lib/underscore-min.js",
"src/util.js",
+ "src/clipboard.js",
"src/imgparticle.js",
"src/particleengine.js",
"src/dragondrop.js",
View
@@ -0,0 +1,12 @@
+
+// Need a way to determine if the dataTransfer object actually has data attached. If it doesn't, then
+// some browsers will just not fire certain drag events.
+Clipboard.prototype.realSetData = Clipboard.prototype.setData;
+Clipboard.prototype.dataSet = false;
+Clipboard.prototype.setData = function(mime_type, data) {
+ this.dataSet = true;
+ this.realSetData(mime_type, data);
+};
+Clipboard.prototype.hasData = function() {
+ return this.dataSet || this.files.length > 0 || this.items.length > 0;
+};
View
@@ -21,6 +21,16 @@ script.onload = function() {
}
});
};
-document.querySelector('html').appendChild(script);
+
+
+// Not sure why the fuck I need to inject this, but while testing on
+// http://www.html5rocks.com/en/tutorials/dnd/basics/
+// it appeared to not work unless I did??? I dunno
+var clipboard = document.createElement('script');
+clipboard.src = chrome.extension.getURL('src/clipboard.js');
+
+var html = document.querySelector('html');
+html.appendChild(script);
+html.appendChild(clipboard);
console.log('what the what');
View
@@ -119,8 +119,8 @@ _.extend(FlameParticleEngine.prototype, {
move: function(event, offset) {
event.preventDefault();
this.canvas.css({
- 'left': (event.clientX + offset[0]) + 'px',
- 'top': (event.clientY + offset[1]) + 'px'
+ 'left': (event.pageX + offset[0]) + 'px',
+ 'top': (event.pageY + offset[1]) + 'px'
});
}
});
View
@@ -18,17 +18,3 @@ Function.prototype.bind = function(a) {
return b.apply(a, d)
}
};
-
-// Need a way to determine if the dataTransfer object actually has data attached. If it doesn't, then
-// some browsers will just not fire certain drag events.
-_.extend(Clipboard.prototype, {
- dataSet: false,
- realSetData: Clipboard.prototype.setData,
- setData: function(mime_type, data) {
- this.dataSet = true;
- this.realSetData(mime_type, data);
- },
- hasData: function() {
- return this.dataSet || this.files.length > 0 || this.items.length > 0;
- }
-})

0 comments on commit e0dd98d

Please sign in to comment.