Commit b39df83c4efc0f6b39d523def257170165f78123

Authored by Benjamin Renard
1 parent 8cc08c31

Correction of a regression related to the fix for #7096

Showing 2 changed files with 72 additions and 30 deletions   Show diff stats
js/app/views/CatalogUI.js
... ... @@ -790,6 +790,12 @@ Ext.define('amdaUI.CatalogUI', {
790 790 selModel: {pruneRemoved: false},
791 791 // selType: 'cellmodel',
792 792 plugins: [cellEditing, {ptype: 'bufferedrenderer'}],
  793 + listeners: {
  794 + afterrender: function () {
  795 + this.TTGrid.headerCt.resizer.tracker.gridBugFix = true;
  796 + },
  797 + scope: this
  798 + },
793 799 dockedItems: [{
794 800 xtype: 'toolbar',
795 801 items: [{
... ... @@ -895,7 +901,7 @@ Ext.define('amdaUI.CatalogUI', {
895 901 dock: 'bottom',
896 902 ui: 'footer',
897 903 height: 140,
898   -
  904 +
899 905 items: [
900 906 {
901 907 type: 'button',
... ...
js/lib/ext-override.js
1   -/**
  1 +/**
2 2 * Project : AMDA-NG4
3 3 * Name : ext-override.js
4 4 * @file ext-override.js
5   -
  5 +
6 6 * @brief patches for extjs
7 7 * @author elena (sencha support)
8 8 * @version $Id: ext-override.js 2345 2014-05-13 09:06:43Z elena $
... ... @@ -10,10 +10,10 @@
10 10 * FT Id : Date : Name - Description
11 11 *******************************************************************************
12 12 * : :16/06/2011 : elena - creation
13   - *
  13 + *
14 14 */
15 15  
16   -Ext.onReady(function () {
  16 +Ext.onReady(function () {
17 17  
18 18 // Fix for #7096
19 19 Ext.override(Ext.dd.DragTracker, {
... ... @@ -27,14 +27,51 @@ Ext.onReady(function () {
27 27 }
28 28 dr.x = dr.left = dr[0] = dr.right = xy[0];
29 29 dr.y = dr.top = dr[1] = dr.bottom = xy[1];
30   - //dr.constrainTo(constrainTo);
  30 + if (!me.gridBugFix)
  31 + dr.constrainTo(constrainTo);
31 32  
32 33 return [dr.left, dr.top];
33   - }
  34 + },
  35 + // Constrain the dragTarget to within the constrain region. Return the passed xy adjusted by the same delta.
  36 + dragTarget: function(me, xy) {
  37 + var s = me.startXY,
  38 + dr = me.startRegion.copy(),
  39 + constrainTo = me.getConstrainRegion(),
  40 + adjust;
  41 + // No constraint
  42 + if (!constrainTo) {
  43 + return xy;
  44 + }
  45 + // See where the passed XY would put the dragTarget if translated by the unconstrained offset.
  46 + // If it overflows, we constrain the passed XY to bring the potential
  47 + // region back within the boundary.
  48 + dr.translateBy(xy[0] - s[0], xy[1] - s[1]);
  49 + // Constrain the X coordinate by however much the dragTarget overflows
  50 + if (dr.right > constrainTo.right) {
  51 + xy[0] += adjust = (constrainTo.right - dr.right);
  52 + // overflowed the right
  53 + dr.left += adjust;
  54 + }
  55 + if (dr.left < constrainTo.left) {
  56 + xy[0] += (constrainTo.left - dr.left);
  57 + }
  58 + // overflowed the left
  59 + // Constrain the Y coordinate by however much the dragTarget overflows
  60 + if (dr.bottom > constrainTo.bottom) {
  61 + xy[1] += adjust = (constrainTo.bottom - dr.bottom);
  62 + // overflowed the bottom
  63 + dr.top += adjust;
  64 + }
  65 + if (dr.top < constrainTo.top) {
  66 + xy[1] += (constrainTo.top - dr.top);
  67 + }
  68 + // overflowed the top
  69 + return xy;
  70 + }
34 71 }
35 72 });
36   -
37   -// for version 4.1.3 - corrected in 4.2.2
  73 +
  74 +// for version 4.1.3 - corrected in 4.2.2
38 75 /*Ext.override(Ext.grid.RowNumberer, {
39 76 renderer: function(value, metaData, record, rowIdx, colIdx, store) {
40 77 var rowspan = this.rowspan;
... ... @@ -42,13 +79,13 @@ Ext.onReady(function () {
42 79 metaData.tdAttr = 'rowspan="' + rowspan + '"';
43 80 }
44 81  
45   - metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special';
46   -
  82 + metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special';
  83 +
47 84 return store.indexOf(record) + 1;
48 85 }
49 86 });*/
50   -
51   -//TODO check if needed for version 4.1.3, 4.2.2
  87 +
  88 +//TODO check if needed for version 4.1.3, 4.2.2
52 89 /*Ext.override(Ext.view.Table, {
53 90 onUpdate : function(store, record, operation, changedFieldNames) {
54 91 var me = this,
... ... @@ -57,15 +94,15 @@ Ext.onReady(function () {
57 94 oldCells, newCells, len, i,
58 95 columns, overItemCls,
59 96 isHovered, row;
60   -
61   - if (me.rendered) {
  97 +
  98 + if (me.rendered) {
62 99 index = me.store.indexOf(record);
63 100 columns = me.headerCt.getGridColumns();
64 101 overItemCls = me.overItemCls;
65 102  
66 103 // If we have columns which may *need* updating (think lockable grid child with all columns either locked or unlocked)
67 104 // and the changed record is within our view, then update the view
68   -
  105 +
69 106 if (columns.length && index > -1) {
70 107 newRow = me.bufferRender([record], index)[0];
71 108 oldRow = me.all.item(index);
... ... @@ -99,37 +136,37 @@ Ext.onReady(function () {
99 136 }
100 137 }
101 138 });*/
102   -
103   -//TODO check if needed for version 4.1.3, 4.2.2
  139 +
  140 +//TODO check if needed for version 4.1.3, 4.2.2
104 141 /*Ext.override(Ext.ZIndexManager, {
105 142 tempHidden: [],
106 143 show: function() {
107 144 var comp, x, y;
108   -
  145 +
109 146 while (comp = this.tempHidden.shift()) {
110 147 x = comp.x;
111 148 y = comp.y;
112   -
  149 +
113 150 comp.show();
114 151 comp.setPosition(x,y);
115 152 }
116   - }
117   - });
  153 + }
  154 + });
118 155  
119 156 Ext.override(Ext.selection.TreeModel, {
120   -
  157 +
121 158 onRowClick: function (view, record, item, index, e) {
122   - // Record index will be -1 if the clicked record is a metadata record and not selectable
  159 + // Record index will be -1 if the clicked record is a metadata record and not selectable
123 160 if (index !== -1) {
124   - if (!this.allowRightMouseSelection(e)) {
125   - return ;
  161 + if (!this.allowRightMouseSelection(e)) {
  162 + return ;
126 163 }
127   -
  164 +
128 165 //Don't process if it's a right-click over a previously selected record.
129 166 // if (!(e.type === 'contextmenu' && this.isSelected(record))) {
130 167 this.processSelection(view, record, item, index, e);
131 168 // }
132   - }
  169 + }
133 170 }
134 171 });
135 172 Ext.override(Ext.selection.Model, {
... ... @@ -161,5 +198,4 @@ Ext.onReady(function () {
161 198 return false;
162 199 }
163 200 });*/
164   -});
165   -
  201 +});
... ...