From b39df83c4efc0f6b39d523def257170165f78123 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 2 Sep 2019 13:58:34 +0200 Subject: [PATCH] Correction of a regression related to the fix for #7096 --- js/app/views/CatalogUI.js | 8 +++++++- js/lib/ext-override.js | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------- 2 files changed, 72 insertions(+), 30 deletions(-) diff --git a/js/app/views/CatalogUI.js b/js/app/views/CatalogUI.js index 03c0fcb..d40610d 100644 --- a/js/app/views/CatalogUI.js +++ b/js/app/views/CatalogUI.js @@ -790,6 +790,12 @@ Ext.define('amdaUI.CatalogUI', { selModel: {pruneRemoved: false}, // selType: 'cellmodel', plugins: [cellEditing, {ptype: 'bufferedrenderer'}], + listeners: { + afterrender: function () { + this.TTGrid.headerCt.resizer.tracker.gridBugFix = true; + }, + scope: this + }, dockedItems: [{ xtype: 'toolbar', items: [{ @@ -895,7 +901,7 @@ Ext.define('amdaUI.CatalogUI', { dock: 'bottom', ui: 'footer', height: 140, - + items: [ { type: 'button', diff --git a/js/lib/ext-override.js b/js/lib/ext-override.js index 389802e..70743ce 100644 --- a/js/lib/ext-override.js +++ b/js/lib/ext-override.js @@ -1,8 +1,8 @@ -/** +/** * Project : AMDA-NG4 * Name : ext-override.js * @file ext-override.js - + * @brief patches for extjs * @author elena (sencha support) * @version $Id: ext-override.js 2345 2014-05-13 09:06:43Z elena $ @@ -10,10 +10,10 @@ * FT Id : Date : Name - Description ******************************************************************************* * : :16/06/2011 : elena - creation - * + * */ -Ext.onReady(function () { +Ext.onReady(function () { // Fix for #7096 Ext.override(Ext.dd.DragTracker, { @@ -27,14 +27,51 @@ Ext.onReady(function () { } dr.x = dr.left = dr[0] = dr.right = xy[0]; dr.y = dr.top = dr[1] = dr.bottom = xy[1]; - //dr.constrainTo(constrainTo); + if (!me.gridBugFix) + dr.constrainTo(constrainTo); return [dr.left, dr.top]; - } + }, + // Constrain the dragTarget to within the constrain region. Return the passed xy adjusted by the same delta. + dragTarget: function(me, xy) { + var s = me.startXY, + dr = me.startRegion.copy(), + constrainTo = me.getConstrainRegion(), + adjust; + // No constraint + if (!constrainTo) { + return xy; + } + // See where the passed XY would put the dragTarget if translated by the unconstrained offset. + // If it overflows, we constrain the passed XY to bring the potential + // region back within the boundary. + dr.translateBy(xy[0] - s[0], xy[1] - s[1]); + // Constrain the X coordinate by however much the dragTarget overflows + if (dr.right > constrainTo.right) { + xy[0] += adjust = (constrainTo.right - dr.right); + // overflowed the right + dr.left += adjust; + } + if (dr.left < constrainTo.left) { + xy[0] += (constrainTo.left - dr.left); + } + // overflowed the left + // Constrain the Y coordinate by however much the dragTarget overflows + if (dr.bottom > constrainTo.bottom) { + xy[1] += adjust = (constrainTo.bottom - dr.bottom); + // overflowed the bottom + dr.top += adjust; + } + if (dr.top < constrainTo.top) { + xy[1] += (constrainTo.top - dr.top); + } + // overflowed the top + return xy; + } } }); - -// for version 4.1.3 - corrected in 4.2.2 + +// for version 4.1.3 - corrected in 4.2.2 /*Ext.override(Ext.grid.RowNumberer, { renderer: function(value, metaData, record, rowIdx, colIdx, store) { var rowspan = this.rowspan; @@ -42,13 +79,13 @@ Ext.onReady(function () { metaData.tdAttr = 'rowspan="' + rowspan + '"'; } - metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special'; - + metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special'; + return store.indexOf(record) + 1; } });*/ - -//TODO check if needed for version 4.1.3, 4.2.2 + +//TODO check if needed for version 4.1.3, 4.2.2 /*Ext.override(Ext.view.Table, { onUpdate : function(store, record, operation, changedFieldNames) { var me = this, @@ -57,15 +94,15 @@ Ext.onReady(function () { oldCells, newCells, len, i, columns, overItemCls, isHovered, row; - - if (me.rendered) { + + if (me.rendered) { index = me.store.indexOf(record); columns = me.headerCt.getGridColumns(); overItemCls = me.overItemCls; // If we have columns which may *need* updating (think lockable grid child with all columns either locked or unlocked) // and the changed record is within our view, then update the view - + if (columns.length && index > -1) { newRow = me.bufferRender([record], index)[0]; oldRow = me.all.item(index); @@ -99,37 +136,37 @@ Ext.onReady(function () { } } });*/ - -//TODO check if needed for version 4.1.3, 4.2.2 + +//TODO check if needed for version 4.1.3, 4.2.2 /*Ext.override(Ext.ZIndexManager, { tempHidden: [], show: function() { var comp, x, y; - + while (comp = this.tempHidden.shift()) { x = comp.x; y = comp.y; - + comp.show(); comp.setPosition(x,y); } - } - }); + } + }); Ext.override(Ext.selection.TreeModel, { - + onRowClick: function (view, record, item, index, e) { - // Record index will be -1 if the clicked record is a metadata record and not selectable + // Record index will be -1 if the clicked record is a metadata record and not selectable if (index !== -1) { - if (!this.allowRightMouseSelection(e)) { - return ; + if (!this.allowRightMouseSelection(e)) { + return ; } - + //Don't process if it's a right-click over a previously selected record. // if (!(e.type === 'contextmenu' && this.isSelected(record))) { this.processSelection(view, record, item, index, e); // } - } + } } }); Ext.override(Ext.selection.Model, { @@ -161,5 +198,4 @@ Ext.onReady(function () { return false; } });*/ -}); - +}); -- libgit2 0.21.2