PHP Classes

File: public/js/tinymce/src/plugins/contextmenu/src/main/js/core/Coords.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/contextmenu/src/main/js/core/Coords.js   Download  
File: public/js/tinymce/src/plugins/contextmenu/src/main/js/core/Coords.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,774 bytes
 

Contents

Class file image Download
/** * Coords.js * * Released under LGPL License. * Copyright (c) 1999-2017 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ define( 'tinymce.plugins.contextmenu.core.Coords', [ 'tinymce.core.Env', 'tinymce.core.dom.DOMUtils' ], function (Env, DOMUtils) { var nu = function (x, y) { return { x: x, y: y }; }; var transpose = function (pos, dx, dy) { return nu(pos.x + dx, pos.y + dy); }; var fromPageXY = function (e) { return nu(e.pageX, e.pageY); }; var fromClientXY = function (e) { return nu(e.clientX, e.clientY); }; var transposeUiContainer = function (element, pos) { if (element && DOMUtils.DOM.getStyle(element, 'position', true) !== 'static') { var containerPos = DOMUtils.DOM.getPos(element); var dx = containerPos.x - element.scrollLeft; var dy = containerPos.y - element.scrollTop; return transpose(pos, -dx, -dy); } else { return transpose(pos, 0, 0); } }; var transposeContentAreaContainer = function (element, pos) { var containerPos = DOMUtils.DOM.getPos(element); return transpose(pos, containerPos.x, containerPos.y); }; var getUiContainer = function (editor) { return Env.container; }; var getPos = function (editor, e) { if (editor.inline) { return transposeUiContainer(getUiContainer(editor), fromPageXY(e)); } else { var iframePos = transposeContentAreaContainer(editor.getContentAreaContainer(), fromClientXY(e)); return transposeUiContainer(getUiContainer(editor), iframePos); } }; return { getPos: getPos }; } );