只读模式
group, 分享
评论更多问题
博客标签总是存在一个
This commit is contained in:
lealife
2015-06-15 18:01:48 +08:00
parent 7e458bb433
commit 6987a38820
1453 changed files with 114561 additions and 91536 deletions

20
public/tinymce/classes/ui/GridLayout.js Normal file → Executable file
View File

@ -37,7 +37,7 @@ define("tinymce/ui/GridLayout", [
recalc: function(container) {
var settings = container.settings, rows, cols, items, contLayoutRect, width, height, rect,
ctrlLayoutRect, ctrl, x, y, posX, posY, ctrlSettings, contPaddingBox, align, spacingH, spacingV, alignH, alignV, maxX, maxY,
colWidths = [], rowHeights = [], ctrlMinWidth, ctrlMinHeight, alignX, alignY, availableWidth, availableHeight;
colWidths = [], rowHeights = [], ctrlMinWidth, ctrlMinHeight, availableWidth, availableHeight, reverseRows, idx;
// Get layout settings
settings = container.settings;
@ -50,12 +50,13 @@ define("tinymce/ui/GridLayout", [
alignH = settings.alignH || settings.align;
alignV = settings.alignV || settings.align;
contPaddingBox = container._paddingBox;
reverseRows = 'reverseRows' in settings ? settings.reverseRows : container.isRtl();
if (alignH && typeof(alignH) == "string") {
if (alignH && typeof alignH == "string") {
alignH = [alignH];
}
if (alignV && typeof(alignV) == "string") {
if (alignV && typeof alignV == "string") {
alignV = [alignV];
}
@ -166,7 +167,7 @@ define("tinymce/ui/GridLayout", [
// Calculate new column widths based on flex values
var ratio = availableWidth / totalFlex;
for (x = 0; x < cols; x++) {
colWidths[x] += flexWidths ? Math.ceil(flexWidths[x] * ratio) : ratio;
colWidths[x] += flexWidths ? flexWidths[x] * ratio : ratio;
}
// Move/resize controls
@ -176,7 +177,13 @@ define("tinymce/ui/GridLayout", [
height = rowHeights[y] + flexV;
for (x = 0; x < cols; x++) {
ctrl = items[y * cols + x];
if (reverseRows) {
idx = y * cols + cols - 1 - x;
} else {
idx = y * cols + x;
}
ctrl = items[idx];
// No more controls to render then break
if (!ctrl) {
@ -187,7 +194,6 @@ define("tinymce/ui/GridLayout", [
ctrlSettings = ctrl.settings;
ctrlLayoutRect = ctrl.layoutRect();
width = Math.max(colWidths[x], ctrlLayoutRect.startMinWidth);
alignX = alignY = 0;
ctrlLayoutRect.x = posX;
ctrlLayoutRect.y = posY;
@ -205,7 +211,7 @@ define("tinymce/ui/GridLayout", [
align = ctrlSettings.alignV || (alignV ? (alignV[x] || alignV[0]) : null);
if (align == "center") {
ctrlLayoutRect.y = posY + (height / 2) - (ctrlLayoutRect.h / 2);
} else if (align == "bottom") {
} else if (align == "bottom") {
ctrlLayoutRect.y = posY + height - ctrlLayoutRect.h;
} else if (align == "stretch") {
ctrlLayoutRect.h = height;