This is a migrated thread and some comments may be shown as answers.

Drag and Drop Images in RadEditor example, small error

1 Answer 47 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Andrew Metcalfe
Top achievements
Rank 2
Andrew Metcalfe asked on 21 Jan 2009, 10:35 AM
We have just implemented the Drag and Drop images example into our backend and it seems there is a small JS error:

http://demos.telerik.com/aspnet-ajax/Editor/Examples/TreeviewAndEditor/DefaultCS.aspx


In the JS function isMouseOverEditor I think you actually need to replace

            var mouseX = events.clientX;
            var mouseY = events.clientY;


with

            var mouseX = events.offsetX;
            var mouseY = events.offsetY;
 

See full original code:

//Check if the image is over the editor or not
        function isMouseOverEditor(editor, events)
        {        
            var editorFrame = editor.get_contentAreaElement();
            var editorRect = $telerik.getBounds(editorFrame);    
                                        
            var mouseX = events.clientX;
            var mouseY = events.clientY;
        
            if (mouseX < (editorRect.x + editorRect.width) &&
             mouseX > editorRect.x &&
                mouseY < (editorRect.y + editorRect.height) &&
             mouseY > editorRect.y)
            {
                return true;
            }            
            return false;
        }


We had the editor in a splitter so it was moving around and I am guessing this caused the problem.



1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 26 Jan 2009, 03:03 PM
Hi Andrew,

We are glad that you have solved the problem on your side. Let us know if you find anything else that could be of help for our community.

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Andrew Metcalfe
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Share this question
or