aboutsummaryrefslogtreecommitdiff
path: root/js/clipboard/internal-ops/elements-clipboard-agent.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/clipboard/internal-ops/elements-clipboard-agent.js')
-rw-r--r--js/clipboard/internal-ops/elements-clipboard-agent.js42
1 files changed, 37 insertions, 5 deletions
diff --git a/js/clipboard/internal-ops/elements-clipboard-agent.js b/js/clipboard/internal-ops/elements-clipboard-agent.js
index ef89ab35..627267fa 100644
--- a/js/clipboard/internal-ops/elements-clipboard-agent.js
+++ b/js/clipboard/internal-ops/elements-clipboard-agent.js
@@ -1,7 +1,31 @@
1/* <copyright> 1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/> 2Copyright (c) 2012, Motorola Mobility, Inc
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> 3All Rights Reserved.
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4BSD License.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9 - Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14 - Neither the name of Motorola Mobility nor the names of its contributors
15 may be used to endorse or promote products derived from this software
16 without specific prior written permission.
17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE.
5</copyright> */ 29</copyright> */
6 30
7//////////////////////////////////////////////////////////////////////// 31////////////////////////////////////////////////////////////////////////
@@ -328,7 +352,7 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
328 352
329 pastePositioned:{ 353 pastePositioned:{
330 value: function(element, styles, fromCopy){// for now can wok for both in-place and centered paste 354 value: function(element, styles, fromCopy){// for now can wok for both in-place and centered paste
331 var modObject = [], x,y, newX, newY, counter; 355 var modObject = [], x,y, newX, newY, counter, self = this;
332 356
333 if((typeof fromCopy === "undefined") || (fromCopy && fromCopy === true)){ 357 if((typeof fromCopy === "undefined") || (fromCopy && fromCopy === true)){
334 counter = this.pasteCounter; 358 counter = this.pasteCounter;
@@ -346,6 +370,14 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
346 if(!styles || (styles && !styles.position)){ 370 if(!styles || (styles && !styles.position)){
347 this.application.ninja.elementMediator.addElements(element, null, false); 371 this.application.ninja.elementMediator.addElements(element, null, false);
348 }else if(styles && (styles.position === "absolute")){ 372 }else if(styles && (styles.position === "absolute")){
373 if((element.tagName === "IMG") || (element.getAttribute("type") === "image/svg+xml")){
374 element.onload = function(){
375 element.onload = null;
376 //refresh selection
377 self.application.ninja.stage.needsDraw = true;
378 }
379 }
380
349 this.application.ninja.elementMediator.addElements(element, {"top" : newY, "left" : newX}, false);//displace 381 this.application.ninja.elementMediator.addElements(element, {"top" : newY, "left" : newX}, false);//displace
350 } 382 }
351 this.application.ninja.elementMediator.addDelegate = addDelegate; 383 this.application.ninja.elementMediator.addDelegate = addDelegate;
@@ -369,4 +401,4 @@ var ElementsClipboardAgent = exports.ElementsClipboardAgent = Montage.create(Com
369 } 401 }
370 402
371 403
372}); \ No newline at end of file 404});