aboutsummaryrefslogtreecommitdiff
path: root/js/clipboard/internal-ops/elements-clipboard-agent.js
diff options
context:
space:
mode:
authorKruti Shah2012-07-19 10:08:07 -0700
committerKruti Shah2012-07-19 10:08:07 -0700
commit5741fbc0a2eb1a43017b76406056bc98cdf00297 (patch)
treec6b478666eab9e637039467d70e948e1e0e46882 /js/clipboard/internal-ops/elements-clipboard-agent.js
parent0b899ad6cec5e4626dfa32230be7c04d22d4f820 (diff)
parent142dc59794769ad783ab050b27b4f56ac5773afb (diff)
downloadninja-5741fbc0a2eb1a43017b76406056bc98cdf00297.tar.gz
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'js/clipboard/internal-ops/elements-clipboard-agent.js')
-rw-r--r--js/clipboard/internal-ops/elements-clipboard-agent.js24
1 files changed, 8 insertions, 16 deletions
diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js
index a6bce2ba..cfc75916 100644
--- a/js/clipboard/internal-ops/elements-clipboard-agent.js
+++ b/js/clipboard/internal-ops/elements-clipboard-agent.js
@@ -152,8 +152,6 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
152 152
153 this.pasteCounter++; 153 this.pasteCounter++;
154 154
155 //cleanse HTML
156
157 for(j=0; j< this.copiedObjects.copy.length; j++){ 155 for(j=0; j< this.copiedObjects.copy.length; j++){
158 copiedElement = this.copiedObjects.copy[j]; 156 copiedElement = this.copiedObjects.copy[j];
159 styles = null; 157 styles = null;
@@ -259,16 +257,13 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
259 257
260 if(sourceCanvas.ownerDocument.defaultView.getComputedStyle(sourceCanvas).getPropertyValue("position") === "absolute"){ 258 if(sourceCanvas.ownerDocument.defaultView.getComputedStyle(sourceCanvas).getPropertyValue("position") === "absolute"){
261 styles = canvas.elementModel.data || {}; 259 styles = canvas.elementModel.data || {};
262 styles.top = "" + (this.application.ninja.elementMediator.getProperty(sourceCanvas, "top", parseInt) + (25 * this.pasteCounter))+"px"; 260 styles.top = "" + (this.application.ninja.elementMediator.getProperty(sourceCanvas, "top", parseInt) + (10 * this.pasteCounter))+"px";
263 styles.left = "" + (this.application.ninja.elementMediator.getProperty(sourceCanvas, "left", parseInt) + (25 * this.pasteCounter)) + "px"; 261 styles.left = "" + (this.application.ninja.elementMediator.getProperty(sourceCanvas, "left", parseInt) + (10 * this.pasteCounter)) + "px";
264 }else{ 262 }else{
265 styles = null; 263 styles = null;
266 } 264 }
267 265
268 var addDelegate = this.application.ninja.elementMediator.addDelegate; 266 this.application.ninja.elementMediator.addElements(canvas, styles, false/*notify*/, false /*callAddDelegate*/);
269 this.application.ninja.elementMediator.addDelegate = null;
270 this.application.ninja.elementMediator.addElements(canvas, styles, false);
271 this.application.ninja.elementMediator.addDelegate = addDelegate;
272 267
273 worldData = sourceCanvas.elementModel.shapeModel ? sourceCanvas.elementModel.shapeModel.GLWorld.exportJSON(): null; 268 worldData = sourceCanvas.elementModel.shapeModel ? sourceCanvas.elementModel.shapeModel.GLWorld.exportJSON(): null;
274 if(worldData) 269 if(worldData)
@@ -360,13 +355,11 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
360 355
361 x = styles ? ("" + styles.left + "px") : "100px"; 356 x = styles ? ("" + styles.left + "px") : "100px";
362 y = styles ? ("" + styles.top + "px") : "100px"; 357 y = styles ? ("" + styles.top + "px") : "100px";
363 newX = styles ? ("" + (styles.left + (25 * counter)) + "px") : "100px"; 358 newX = styles ? ("" + (styles.left + (10 * counter)) + "px") : "100px";
364 newY = styles ? ("" + (styles.top + (25 * counter)) + "px") : "100px"; 359 newY = styles ? ("" + (styles.top + (10 * counter)) + "px") : "100px";
365 360
366 var addDelegate = this.application.ninja.elementMediator.addDelegate;
367 this.application.ninja.elementMediator.addDelegate = null;
368 if(!styles || (styles && !styles.position)){ 361 if(!styles || (styles && !styles.position)){
369 this.application.ninja.elementMediator.addElements(element, null, false); 362 this.application.ninja.elementMediator.addElements(element, null, false /*notify*/, false /*callAddDelegate*/);
370 }else if(styles && (styles.position === "absolute")){ 363 }else if(styles && (styles.position === "absolute")){
371 if((element.tagName === "IMG") || (element.getAttribute("type") === "image/svg+xml")){ 364 if((element.tagName === "IMG") || (element.getAttribute("type") === "image/svg+xml")){
372 element.onload = function(){ 365 element.onload = function(){
@@ -376,9 +369,8 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
376 } 369 }
377 } 370 }
378 371
379 this.application.ninja.elementMediator.addElements(element, {"top" : newY, "left" : newX}, false);//displace 372 this.application.ninja.elementMediator.addElements(element, {"top" : newY, "left" : newX}, false/*notify*/, false /*callAddDelegate*/);//displace
380 } 373 }
381 this.application.ninja.elementMediator.addDelegate = addDelegate;
382 } 374 }
383 }, 375 },
384 376