Sha256: 9dcd9149bca222cff2e007cb0cc1eb1fddf9797f2009d9e9be8d4446fa3606ff
Contents?: true
Size: 1.44 KB
Versions: 40
Compression:
Stored size: 1.44 KB
Contents
/** * Measure.js * * Released under LGPL License. * Copyright (c) 1999-2016 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ define('tinymce/inlite/core/Measure', [ 'global!tinymce.DOM', 'global!tinymce.geom.Rect', 'tinymce/inlite/core/Convert' ], function (DOM, Rect, Convert) { var toAbsolute = function (rect) { var vp = DOM.getViewPort(); return { x: rect.x + vp.x, y: rect.y + vp.y, w: rect.w, h: rect.h }; }; var measureElement = function (elm) { var clientRect = elm.getBoundingClientRect(); return toAbsolute({ x: clientRect.left, y: clientRect.top, w: Math.max(elm.clientWidth, elm.offsetWidth), h: Math.max(elm.clientHeight, elm.offsetHeight) }); }; var getElementRect = function (editor, elm) { return measureElement(elm); }; var getPageAreaRect = function (editor) { return measureElement(editor.getElement().ownerDocument.body); }; var getContentAreaRect = function (editor) { return measureElement(editor.getContentAreaContainer() || editor.getBody()); }; var getSelectionRect = function (editor) { var clientRect = editor.selection.getBoundingClientRect(); return clientRect ? toAbsolute(Convert.fromClientRect(clientRect)) : null; }; return { getElementRect: getElementRect, getPageAreaRect: getPageAreaRect, getContentAreaRect: getContentAreaRect, getSelectionRect: getSelectionRect }; });
Version data entries
40 entries across 40 versions & 2 rubygems