From d7441481d8a1032a555cbdc26996a4202e424b22 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 29 Jun 2012 16:17:13 -0700 Subject: Fixed IKNINJA-1763, IKNINJA-1807 - refresh stage after loading is done for image and svg Signed-off-by: Ananya Sen --- js/clipboard/internal-ops/elements-clipboard-agent.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'js/clipboard/internal-ops/elements-clipboard-agent.js') diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js index 1a4bfdba..a8bd3b2d 100644 --- a/js/clipboard/internal-ops/elements-clipboard-agent.js +++ b/js/clipboard/internal-ops/elements-clipboard-agent.js @@ -325,7 +325,7 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com pastePositioned:{ value: function(element, styles, fromCopy){// for now can wok for both in-place and centered paste - var modObject = [], x,y, newX, newY, counter; + var modObject = [], x,y, newX, newY, counter, self = this, addElementsFlag = true; if((typeof fromCopy === "undefined") || (fromCopy && fromCopy === true)){ counter = this.pasteCounter; @@ -341,6 +341,14 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com if(!styles || (styles && !styles.position)){ this.application.ninja.elementMediator.addElements(element, null, false); }else if(styles && (styles.position === "absolute")){ + if((element.tagName === "IMG") || (element.getAttribute("type") === "image/svg+xml")){ + element.onload = function(){ + element.onload = null; + //refresh selection + self.application.ninja.stage.needsDraw = true; + } + } + this.application.ninja.elementMediator.addElements(element, {"top" : newY, "left" : newX}, false);//displace } } -- cgit v1.2.3 From d00207263caf6b8196b991a681e826b658d0712c Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 29 Jun 2012 16:19:48 -0700 Subject: removing unnecessary variable Signed-off-by: Ananya Sen --- js/clipboard/internal-ops/elements-clipboard-agent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/clipboard/internal-ops/elements-clipboard-agent.js') diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js index a8bd3b2d..1f3db331 100644 --- a/js/clipboard/internal-ops/elements-clipboard-agent.js +++ b/js/clipboard/internal-ops/elements-clipboard-agent.js @@ -325,7 +325,7 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com pastePositioned:{ value: function(element, styles, fromCopy){// for now can wok for both in-place and centered paste - var modObject = [], x,y, newX, newY, counter, self = this, addElementsFlag = true; + var modObject = [], x,y, newX, newY, counter, self = this; if((typeof fromCopy === "undefined") || (fromCopy && fromCopy === true)){ counter = this.pasteCounter; -- cgit v1.2.3 From fdf2411fbf8d2d5ec710dded859bb5fa29e867d6 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 2 Jul 2012 13:29:02 -0700 Subject: IKNinja-1736 and IKNinja-1802 - Copy paste WebGL bugs. Signed-off-by: Nivesh Rajbhandari --- js/clipboard/internal-ops/elements-clipboard-agent.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'js/clipboard/internal-ops/elements-clipboard-agent.js') diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js index 1a4bfdba..ef89ab35 100644 --- a/js/clipboard/internal-ops/elements-clipboard-agent.js +++ b/js/clipboard/internal-ops/elements-clipboard-agent.js @@ -243,7 +243,10 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com styles = null; } + var addDelegate = this.application.ninja.elementMediator.addDelegate; + this.application.ninja.elementMediator.addDelegate = null; this.application.ninja.elementMediator.addElements(canvas, styles, false); + this.application.ninja.elementMediator.addDelegate = addDelegate; worldData = sourceCanvas.elementModel.shapeModel ? sourceCanvas.elementModel.shapeModel.GLWorld.exportJSON(): null; if(worldData) @@ -338,11 +341,14 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com newX = styles ? ("" + (styles.left + (25 * counter)) + "px") : "100px"; newY = styles ? ("" + (styles.top + (25 * counter)) + "px") : "100px"; + var addDelegate = this.application.ninja.elementMediator.addDelegate; + this.application.ninja.elementMediator.addDelegate = null; if(!styles || (styles && !styles.position)){ this.application.ninja.elementMediator.addElements(element, null, false); }else if(styles && (styles.position === "absolute")){ this.application.ninja.elementMediator.addElements(element, {"top" : newY, "left" : newX}, false);//displace } + this.application.ninja.elementMediator.addDelegate = addDelegate; } }, -- cgit v1.2.3 From 648ee61ae84216d0236e0dbc211addc13b2cfa3a Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Fri, 6 Jul 2012 11:52:06 -0700 Subject: Expand tabs --- js/clipboard/internal-ops/elements-clipboard-agent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/clipboard/internal-ops/elements-clipboard-agent.js') diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js index 14984593..5c4b7d6f 100644 --- a/js/clipboard/internal-ops/elements-clipboard-agent.js +++ b/js/clipboard/internal-ops/elements-clipboard-agent.js @@ -31,8 +31,8 @@ POSSIBILITY OF SUCH DAMAGE. //////////////////////////////////////////////////////////////////////// // -var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component, +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component, ClipboardUtil = require("js/clipboard/util").ClipboardUtil, World = require("js/lib/drawing/world").World; -- cgit v1.2.3 From bf9dba001ec84243e2f12cd13b0c0ae020fba4a2 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 9 Jul 2012 12:23:13 -0700 Subject: removed unnecessary todo comments Signed-off-by: Ananya Sen --- js/clipboard/internal-ops/elements-clipboard-agent.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'js/clipboard/internal-ops/elements-clipboard-agent.js') diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js index 14984593..fa433a59 100644 --- a/js/clipboard/internal-ops/elements-clipboard-agent.js +++ b/js/clipboard/internal-ops/elements-clipboard-agent.js @@ -141,7 +141,7 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com } }, - pasteFromCopy:{//todo: change to appropriate name + pasteFromCopy:{ value:function(){ var i=0, j=0, pastedElements = [],//array of te pastes clones - for selection @@ -151,7 +151,7 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com this.pasteCounter++; - //TODO: cleanse HTML + //cleanse HTML for(j=0; j< this.copiedObjects.copy.length; j++){ copiedElement = this.copiedObjects.copy[j]; @@ -229,9 +229,6 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com //build the computed style attribute computedStyles = elem.ownerDocument.defaultView.getComputedStyle(elem); - //todo: consider cleaning up the position data [or making position:relative with 0,0] from the computed styles, - // so that the object is pasted onto expernal applicaitons [like gmail] with no offset - for (i = 0; i < computedStyles.length; i++) { stylePropertyName = computedStyles[i]; computedStylesStr = computedStylesStr + stylePropertyName + ":" + computedStyles.getPropertyValue(stylePropertyName) + ";"; -- cgit v1.2.3 From fdbec324dad4ab33d97282ab021d2c1661bc097c Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Mon, 9 Jul 2012 16:27:52 -0700 Subject: BSD License --- .../internal-ops/elements-clipboard-agent.js | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'js/clipboard/internal-ops/elements-clipboard-agent.js') diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js index 4f6e8195..3129b644 100644 --- a/js/clipboard/internal-ops/elements-clipboard-agent.js +++ b/js/clipboard/internal-ops/elements-clipboard-agent.js @@ -1,24 +1,25 @@ /* -Copyright (c) 2012, Motorola Mobility, Inc +Copyright (c) 2012, Motorola Mobility LLC. All Rights Reserved. -BSD License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of Motorola Mobility nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Motorola Mobility LLC nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- cgit v1.2.3