Add version files and new GIF images for UI components
This commit is contained in:
@ -0,0 +1,210 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 4.0.3
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
dhtmlXWindows.prototype._dndInitModule = function() {
|
||||
|
||||
var that = this;
|
||||
|
||||
this._dndOnMouseDown = function(e, id) {
|
||||
|
||||
if (that.conf.dblclick_active) return;
|
||||
|
||||
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
|
||||
|
||||
that.conf.dnd = {
|
||||
id: id,
|
||||
x: e.clientX,
|
||||
y: e.clientY,
|
||||
ready: true,
|
||||
css: false,
|
||||
tr: null,
|
||||
mode: "def", //"def" - move win, "tr" - for translate, "rect" - move rectange
|
||||
moved: false
|
||||
};
|
||||
|
||||
if (that.w[id].conf.keep_in_vp) {
|
||||
that.conf.dnd.minX = 0;
|
||||
that.conf.dnd.maxX = that.vp.clientWidth-that.w[id].conf.w;
|
||||
that.conf.dnd.minY = 0;
|
||||
that.conf.dnd.maxY = that.vp.clientHeight-that.w[id].conf.h;
|
||||
} else {
|
||||
that.conf.dnd.minX = -that.w[id].conf.w+that.conf.vp_pos_ofs;
|
||||
that.conf.dnd.maxX = that.vp.clientWidth-that.conf.vp_pos_ofs;
|
||||
that.conf.dnd.minY = 0;
|
||||
that.conf.dnd.maxY = that.vp.clientHeight-that.conf.vp_pos_ofs;
|
||||
}
|
||||
|
||||
var k = [
|
||||
"MozTransform",
|
||||
"WebkitTransform",
|
||||
"OTransform",
|
||||
"msTransform",
|
||||
"transform"
|
||||
];
|
||||
|
||||
for (var q=0; q<k.length; q++) {
|
||||
if (document.documentElement.style[k[q]] != null && that.conf.dnd.tr == null) {
|
||||
that.conf.dnd.tr = k[q];
|
||||
that.conf.dnd.mode = "tr";
|
||||
}
|
||||
}
|
||||
|
||||
// that.conf.dnd.mode = "def";
|
||||
// console.log("dnd ready, mode: "+that.conf.dnd.mode);
|
||||
|
||||
if (that.conf.dnd.mode == "tr") that.w[id].win.style[that.conf.dnd.tr] = "translate(0px,0px)";
|
||||
|
||||
// init events
|
||||
that._dndInitEvents();
|
||||
|
||||
}
|
||||
|
||||
this._dndOnMouseMove = function(e) {
|
||||
|
||||
e = e||event;
|
||||
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
|
||||
|
||||
var dnd = that.conf.dnd;
|
||||
var w = that.w[dnd.id];
|
||||
|
||||
if (!dnd.css) {
|
||||
w.win.className += " dhxwin_dnd";
|
||||
w.fr_cover.className += " dhxwin_fr_cover_dnd";
|
||||
that.vp.className += " dhxwins_vp_dnd";
|
||||
dnd.css = true;
|
||||
}
|
||||
|
||||
var x = e.clientX-dnd.x;
|
||||
var y = e.clientY-dnd.y;
|
||||
|
||||
dnd.newX = w.conf.x+x;
|
||||
dnd.newY = w.conf.y+y;
|
||||
|
||||
if (dnd.mode == "tr") {
|
||||
|
||||
dnd.newX = Math.min(Math.max(dnd.newX, dnd.minX), dnd.maxX);
|
||||
x = dnd.newX-w.conf.x;
|
||||
|
||||
dnd.newY = Math.min(Math.max(dnd.newY, dnd.minY), dnd.maxY);
|
||||
y = dnd.newY-w.conf.y;
|
||||
|
||||
w.win.style[dnd.tr] = "translate("+x+"px,"+y+"px)";
|
||||
|
||||
} else {
|
||||
|
||||
if (dnd.newX < dnd.minX || dnd.newX > dnd.maxX) {
|
||||
dnd.newX = Math.min(Math.max(dnd.newX, dnd.minX), dnd.maxX);
|
||||
} else {
|
||||
dnd.x = e.clientX;
|
||||
}
|
||||
|
||||
if (dnd.newY < dnd.minY || dnd.newY > dnd.maxY) {
|
||||
dnd.newY = Math.min(Math.max(dnd.newY, dnd.minY), dnd.maxY);
|
||||
} else {
|
||||
dnd.y = e.clientY;
|
||||
}
|
||||
|
||||
that._winSetPosition(dnd.id, dnd.newX, dnd.newY);
|
||||
|
||||
}
|
||||
|
||||
dnd.moved = true;
|
||||
|
||||
w = dnd = null;
|
||||
}
|
||||
|
||||
this._dndOnMouseUp = function() {
|
||||
|
||||
if (that.conf.dnd != null) {
|
||||
|
||||
var dnd = that.conf.dnd;
|
||||
var w = that.w[dnd.id];
|
||||
|
||||
if (dnd.newX != null) {
|
||||
if (dnd.mode == "tr") {
|
||||
that._winSetPosition(dnd.id, dnd.newX, dnd.newY);
|
||||
w.win.style[dnd.tr] = "translate(0px,0px)";
|
||||
}
|
||||
}
|
||||
if (dnd.css) {
|
||||
w.win.className = String(w.win.className).replace(/\s{0,}dhxwin_dnd/gi,"");
|
||||
w.fr_cover.className = String(w.fr_cover.className).replace(/\s{0,}dhxwin_fr_cover_dnd/gi,"");
|
||||
that.vp.className = String(that.vp.className).replace(/\s{0,}dhxwins_vp_dnd/gi,"");
|
||||
}
|
||||
|
||||
that._dndUnloadEvents();
|
||||
|
||||
if (dnd.moved) that._callMainEvent("onMoveFinish", dnd.id);
|
||||
|
||||
w = dnd = that.conf.dnd = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
this._dndOnSelectStart = function(e) {
|
||||
e = e||event;
|
||||
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
this._dndInitEvents = function() {
|
||||
if (typeof(window.addEventListener) == "function") {
|
||||
window.addEventListener("mousemove", this._dndOnMouseMove, false);
|
||||
window.addEventListener("mouseup", this._dndOnMouseUp, false);
|
||||
window.addEventListener("selectstart", this._dndOnSelectStart, false);
|
||||
} else {
|
||||
document.body.attachEvent("onmousemove", this._dndOnMouseMove);
|
||||
document.body.attachEvent("onmouseup", this._dndOnMouseUp);
|
||||
document.body.attachEvent("onselectstart", this._dndOnSelectStart);
|
||||
}
|
||||
}
|
||||
|
||||
this._dndUnloadEvents = function() {
|
||||
if (typeof(window.addEventListener) == "function") {
|
||||
window.removeEventListener("mousemove", this._dndOnMouseMove, false);
|
||||
window.removeEventListener("mouseup", this._dndOnMouseUp, false);
|
||||
window.removeEventListener("selectstart", this._dndOnSelectStart, false);
|
||||
} else {
|
||||
document.body.detachEvent("onmousemove", this._dndOnMouseMove);
|
||||
document.body.detachEvent("onmouseup", this._dndOnMouseUp);
|
||||
document.body.detachEvent("onselectstart", this._dndOnSelectStart);
|
||||
}
|
||||
}
|
||||
|
||||
this._dndUnloadModule = function() {
|
||||
|
||||
this.detachEvent(this.conf.dnd_evid);
|
||||
this.conf.dnd_evid = null;
|
||||
|
||||
this._dndOnMouseDown = null;
|
||||
this._dndOnMouseMove = null;
|
||||
this._dndOnMouseUp = null;
|
||||
this._dndOnSelectStart = null;
|
||||
this._dndInitEvents = null;
|
||||
this._dndUnloadEvents = null;
|
||||
this._dndInitModule = null;
|
||||
this._dndUnloadModule = null;
|
||||
|
||||
that = null;
|
||||
}
|
||||
|
||||
this.conf.dnd_evid = this.attachEvent("_winMouseDown", function(e, data){
|
||||
|
||||
if (e.button >= 2) return;
|
||||
|
||||
if (!(data.mode == "hdr" && e.type == "mousedown" && this.w[data.id].conf.allow_move == true)) return;
|
||||
if (this.w[data.id].conf.maxed && this.w[data.id].conf.max_w == null && this.w[data.id].conf.max_h == null) return;
|
||||
|
||||
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
|
||||
this._dndOnMouseDown(e, data.id);
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@ -0,0 +1,228 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 4.0.3
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
// global context menu
|
||||
dhtmlXWindows.prototype.attachContextMenu = function(conf) {
|
||||
return this._renderContextMenu("icon", null, null, conf);
|
||||
};
|
||||
dhtmlXWindows.prototype.getContextMenu = function() {
|
||||
if (this.cm != null && this.cm.global != null) return this.cm.global;
|
||||
return null;
|
||||
};
|
||||
dhtmlXWindows.prototype.detachContextMenu = function() {
|
||||
this._detachContextMenu("icon", null, null);
|
||||
};
|
||||
|
||||
// custom menu
|
||||
dhtmlXWindowsCell.prototype.attachContextMenu = function(conf) {
|
||||
return this.wins._renderContextMenu("icon", this._idd, null, conf);
|
||||
};
|
||||
dhtmlXWindowsCell.prototype.getContextMenu = function() {
|
||||
if (this.wins.cm != null && this.wins.cm.icon[this._idd] != null) return this.wins.cm.icon[this._idd];
|
||||
return null;
|
||||
};
|
||||
dhtmlXWindowsCell.prototype.detachContextMenu = function() {
|
||||
this.wins._detachContextMenu("icon", this._idd, null);
|
||||
};
|
||||
|
||||
// menu for button
|
||||
dhtmlXWindowsButton.prototype.attachContextMenu = function(conf) {
|
||||
return this.conf.wins._renderContextMenu("button", this.conf.winId, this.conf.name, conf);
|
||||
};
|
||||
dhtmlXWindowsButton.prototype.getContextMenu = function() {
|
||||
if (this.conf.wins.cm == null || this.conf.wins.cm.button[this.conf.winId] == null) return null;
|
||||
if (this.conf.wins.cm.button[this.conf.winId][this.conf.name] != null) return this.conf.wins.cm.button[this.conf.winId][this.conf.name];
|
||||
return null;
|
||||
};
|
||||
dhtmlXWindowsButton.prototype.detachContextMenu = function() {
|
||||
this.conf.wins._detachContextMenu("button", this.conf.winId, this.conf.name);
|
||||
};
|
||||
|
||||
dhtmlXWindows.prototype._renderContextMenu = function(mode, wId, bId, conf) {
|
||||
|
||||
var that = this;
|
||||
var firstInit = false;
|
||||
|
||||
if (this.cm == null) {
|
||||
this.cm = {
|
||||
global: null, // global context menu for icon
|
||||
icon: {}, // custom for icon, {winId:menuInst, winId2:menuInst2}
|
||||
button: {} // custom foc button, {winId:{buttonId:menuInst, buttonId2:menuInst2}, winId2:{..}}
|
||||
};
|
||||
firstInit = true;
|
||||
}
|
||||
|
||||
// check if already attached
|
||||
if (wId == null) {
|
||||
if (this.cm.global != null) return;
|
||||
} else if (mode == "icon") {
|
||||
if (this.cm.icon[wId] != null) return;
|
||||
} else if (mode == "button") {
|
||||
if (this.cm.button[wId] != null && this.cm.button[wId][bId] != null) return;
|
||||
}
|
||||
|
||||
|
||||
// init
|
||||
if (conf == null) conf = {};
|
||||
conf.parent = null;
|
||||
conf.context = true;
|
||||
|
||||
var menu = new dhtmlXMenuObject(conf);
|
||||
menu.setAutoHideMode(false);
|
||||
|
||||
menu.attachEvent("onShow", function() {
|
||||
this.conf.wins_menu_open = true;
|
||||
});
|
||||
|
||||
menu.attachEvent("onHide", function() {
|
||||
this.conf.wins_menu_open = false;
|
||||
that.conf.opened_menu = null;
|
||||
});
|
||||
|
||||
if (wId == null) {
|
||||
this.cm.global = menu;
|
||||
} else if (mode == "icon") {
|
||||
this.cm.icon[wId] = menu;
|
||||
} else if (mode == "button") {
|
||||
if (this.cm.button[wId] == null) this.cm.button[wId] = {};
|
||||
this.cm.button[wId][bId] = menu;
|
||||
}
|
||||
|
||||
if (firstInit) {
|
||||
|
||||
this._showContextMenu = function(e, data) {
|
||||
|
||||
if (e.button >= 2) return;
|
||||
|
||||
if (data.mode == "icon" && data.id != null && data.press_type == "mousedown") {
|
||||
|
||||
var menu = this.cm.icon[data.id]||this.cm.global;
|
||||
if (menu == null) return;
|
||||
|
||||
e.cancelBubble = true;
|
||||
|
||||
var icon = this.w[data.id].hdr.firstChild;
|
||||
|
||||
if (menu.conf.wins_menu_open && this.conf.opened_menu == data.id) {
|
||||
menu.hideContextMenu();
|
||||
} else {
|
||||
this._hideContextMenu();
|
||||
menu.showContextMenu(window.dhx4.absLeft(icon), window.dhx4.absTop(icon)+icon.offsetHeight);
|
||||
this.conf.opened_menu = data.id;
|
||||
}
|
||||
menu = icon = null;
|
||||
|
||||
}
|
||||
|
||||
if (data.mode == "button" && data.id != null && data.press_type == "mousedown") {
|
||||
|
||||
if (this.cm.button[data.id] == null || this.cm.button[data.id][data.button_name] == null) return;
|
||||
|
||||
e.cancelBubble = true;
|
||||
|
||||
this.conf.button_last = null; // cancel button click
|
||||
|
||||
var menu = this.cm.button[data.id][data.button_name];
|
||||
var button = this.w[data.id].b[data.button_name].button;
|
||||
|
||||
if (menu.conf.wins_menu_open && this.conf.opened_menu == data.id) {
|
||||
menu.hideContextMenu();
|
||||
} else {
|
||||
this._hideContextMenu();
|
||||
menu.showContextMenu(window.dhx4.absLeft(button), window.dhx4.absTop(button)+button.offsetHeight);
|
||||
this.conf.opened_menu = data.id;
|
||||
}
|
||||
menu = button = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this._hideContextMenu = function(e) {
|
||||
|
||||
if (e != null) {
|
||||
e = e||event;
|
||||
if (e.type == "keydown" && e.keyCode != 27) return;
|
||||
|
||||
var t = e.target||e.srcElement;
|
||||
var m = true;
|
||||
while (t != null && m == true) {
|
||||
if (t.className != null && t.className.search(/SubLevelArea_Polygon/) >= 0) {
|
||||
m = false;
|
||||
} else {
|
||||
t = t.parentNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m || e == null) {
|
||||
if (that.cm.global != null) that.cm.global.hideContextMenu();
|
||||
for (var a in that.cm.icon) {
|
||||
if (that.cm.icon[a] != null) that.cm.icon[a].hideContextMenu();
|
||||
}
|
||||
for (var a in that.cm.button) {
|
||||
for (var b in that.cm.button[a]) {
|
||||
if (that.cm.button[a][b] != null) that.cm.button[a][b].hideContextMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this._detachContextMenu = function(mode, wId, bId) {
|
||||
if (this.cm == null) return;
|
||||
if (wId == null) {
|
||||
if (this.cm.global != null) {
|
||||
this.cm.global.unload();
|
||||
this.cm.global = null;
|
||||
}
|
||||
} else if (mode == "icon") {
|
||||
if (this.cm.icon[wId] != null) {
|
||||
this.cm.icon[wId].unload();
|
||||
this.cm.icon[wId] = null;
|
||||
}
|
||||
} else if (mode == "button") {
|
||||
if (this.cm.button[wId] != null && this.cm.button[wId][bId] != null) {
|
||||
this.cm.button[wId][bId].unload();
|
||||
this.cm.button[wId][bId] = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.attachEvent("_winMouseDown", this._showContextMenu);
|
||||
|
||||
if (typeof(window.addEventListener) == "function") {
|
||||
window.addEventListener("mousedown", this._hideContextMenu, false);
|
||||
window.addEventListener("keydown", this._hideContextMenu, false);
|
||||
} else {
|
||||
document.body.attachEvent("onmousedown", this._hideContextMenu);
|
||||
document.body.attachEvent("onkeydown", this._hideContextMenu);
|
||||
}
|
||||
|
||||
this._unloadContextMenu = function() {
|
||||
|
||||
// remove only global menu if any, other will removed from win/button unload
|
||||
this._detachContextMenu("icon", null, null);
|
||||
this.cm = null;
|
||||
|
||||
if (typeof(window.addEventListener) == "function") {
|
||||
window.removeEventListener("mousedown", this._hideContextMenu, false);
|
||||
window.removeEventListener("keydown", this._hideContextMenu, false);
|
||||
} else {
|
||||
document.body.detachEvent("onmousedown", this._hideContextMenu);
|
||||
document.body.detachEvent("onkeydown", this._hideContextMenu);
|
||||
}
|
||||
|
||||
that = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return menu;
|
||||
};
|
||||
@ -0,0 +1,320 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 4.0.3
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
dhtmlXWindowsCell.prototype._initResize = function() {
|
||||
|
||||
var that = this;
|
||||
var n = navigator.userAgent;
|
||||
|
||||
this.conf.resize = {
|
||||
b_width: 6,
|
||||
c_type: (n.indexOf("MSIE 10.0")>0||n.indexOf("MSIE 9.0")>0||n.indexOf("MSIE 8.0")>0||n.indexOf("MSIE 7.0")>0||n.indexOf("MSIE 6.0")>0)
|
||||
};
|
||||
|
||||
this._rOnCellMouseMove = function(e) {
|
||||
|
||||
if (that.wins.conf.resize_actv == true || that.wins.w[that._idd].conf.allow_resize == false || that.conf.progress == true || that.wins.w[that._idd].conf.maxed == true || that.wins.w[that._idd].conf.fs_mode == true) {
|
||||
var k = that.wins.w[that._idd].brd;
|
||||
if (k.style.cursor != "default") k.style.cursor = "default";
|
||||
k = null;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
e = e||event;
|
||||
|
||||
var cont = that.wins.w[that._idd].brd;
|
||||
var r = that.conf.resize;
|
||||
|
||||
var no_header = (that.wins.w[that._idd].conf.header==false);
|
||||
|
||||
var x = e.clientX;
|
||||
var y = e.clientY;
|
||||
|
||||
var x0 = window.dhx4.absLeft(cont);
|
||||
var y0 = window.dhx4.absTop(cont);
|
||||
|
||||
var mode = "";
|
||||
if (x <= x0+r.b_width) { // left
|
||||
mode = "w";
|
||||
} else if (x >= x0+cont.offsetWidth-r.b_width) { // right
|
||||
mode = "e";
|
||||
}
|
||||
if (y >= y0+cont.offsetHeight-r.b_width) { // bottom
|
||||
mode = "s"+mode;
|
||||
} else if (no_header && y <= y0+r.b_width) { // top (only for no_header mode)
|
||||
mode = "n"+mode;
|
||||
}
|
||||
|
||||
if (mode == "") mode = false;
|
||||
if (r.mode != mode) {
|
||||
r.mode = mode;
|
||||
if (mode == false) {
|
||||
cont.style.cursor = "default";
|
||||
} else {
|
||||
cont.style.cursor = mode+"-resize";
|
||||
}
|
||||
}
|
||||
|
||||
cont = r = null;
|
||||
};
|
||||
|
||||
this._rOnCellMouseDown = function(e) {
|
||||
|
||||
if (that.conf.resize.mode == false) return;
|
||||
if (that.conf.progress == true) return; // if progress is on - deny
|
||||
if (that.wins.w[that._idd].conf.allow_resize == false) return;
|
||||
if (that.wins.w[that._idd].conf.fs_mode == true) return; // fullscreened window
|
||||
|
||||
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
|
||||
|
||||
var w = that.wins.w[that._idd];
|
||||
var r = that.conf.resize;
|
||||
|
||||
that.wins.conf.resize_actv = true;
|
||||
|
||||
r.min_w = w.conf.min_w;
|
||||
r.min_h = w.conf.min_h;
|
||||
r.max_w = w.conf.max_w||+Infinity;
|
||||
r.max_h = w.conf.max_h||+Infinity;
|
||||
|
||||
// if layout attached - check custom min w/h
|
||||
if (w.cell.dataType == "layout" && w.cell.dataObj != null && typeof(w.cell.dataObj._getWindowMinDimension) == "function") {
|
||||
var t = w.cell.dataObj._getWindowMinDimension(w.cell);
|
||||
r.min_w = Math.max(t.w, r.min_w);
|
||||
r.min_h = Math.max(t.h, r.min_h);
|
||||
}
|
||||
|
||||
r.vp_l = that.wins.conf.vp_pos_ofs;
|
||||
r.vp_r = that.wins.vp.clientWidth-that.wins.conf.vp_pos_ofs;
|
||||
r.vp_b = that.wins.vp.clientHeight-that.wins.conf.vp_pos_ofs;
|
||||
|
||||
r.x = e.clientX;
|
||||
r.y = e.clientY;
|
||||
|
||||
// start resize
|
||||
if (typeof(window.addEventListener) == "function") {
|
||||
window.addEventListener("mousemove", that._rOnWinMouseMove, false);
|
||||
window.addEventListener("mouseup", that._rOnWinMouseUp, false);
|
||||
window.addEventListener("selectstart", that._rOnSelectStart, false);
|
||||
} else {
|
||||
document.body.attachEvent("onmousemove", that._rOnWinMouseMove);
|
||||
document.body.attachEvent("onmouseup", that._rOnWinMouseUp);
|
||||
document.body.attachEvent("onselectstart", that._rOnSelectStart);
|
||||
}
|
||||
|
||||
r.resized = false;
|
||||
|
||||
r.vp_cursor = that.wins.vp.style.cursor;
|
||||
that.wins.vp.style.cursor = r.mode+"-resize";
|
||||
|
||||
w = r = null;
|
||||
};
|
||||
|
||||
this._rOnWinMouseMove = function(e) {
|
||||
|
||||
// resize in progress
|
||||
e = e||event;
|
||||
|
||||
var w = that.wins.w[that._idd];
|
||||
var r = that.conf.resize;
|
||||
|
||||
if (!r.resized) {
|
||||
w.fr_cover.className += " dhxwin_fr_cover_resize";
|
||||
r.resized = true;
|
||||
}
|
||||
|
||||
var x = e.clientX-r.x;
|
||||
var y = e.clientY-r.y;
|
||||
|
||||
if (r.mode.indexOf("e") >= 0) { // right win side dragged
|
||||
|
||||
r.rw = Math.min(Math.max(w.conf.w+x, r.min_w), r.max_w);
|
||||
r.rx = null;
|
||||
|
||||
if (w.conf.x+r.rw < r.vp_l) { // check overflow to left
|
||||
r.rw = r.vp_l-w.conf.x;
|
||||
} else if (w.conf.x+r.rw > that.wins.vp.clientWidth) { // and right
|
||||
r.rw = that.wins.vp.clientWidth-w.conf.x;
|
||||
}
|
||||
|
||||
} else if (r.mode.indexOf("w") >= 0) { // left win side dragged
|
||||
|
||||
r.rw = Math.min(Math.max(w.conf.w-x,r.min_w),r.max_w);
|
||||
r.rx = w.conf.x+w.conf.w-r.rw;
|
||||
|
||||
if (r.rx < 0) { // check overflow to left
|
||||
r.rw = r.rw+r.rx;
|
||||
r.rx = 0;
|
||||
} else if (r.rx > r.vp_r) { // and right
|
||||
r.rw = r.rw-r.vp_r;
|
||||
r.rx = r.vp_r;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (r.mode.indexOf("s") >= 0) { // bottom win side (can be together with left or right)
|
||||
|
||||
r.rh = Math.min(Math.max(w.conf.h+y, r.min_h),r.max_h);
|
||||
r.ry = null;
|
||||
|
||||
if (w.conf.y+r.rh > that.wins.vp.clientHeight) { // bottom overflow
|
||||
r.rh = that.wins.vp.clientHeight-w.conf.y;
|
||||
}
|
||||
|
||||
} else if (r.mode.indexOf("n") >= 0) { // top win side (can be together with left or right) (only for no_header mode)
|
||||
|
||||
r.rh = Math.min(Math.max(w.conf.h-y, r.min_h),r.max_h);
|
||||
r.ry = w.conf.y+w.conf.h-r.rh;
|
||||
|
||||
if (r.ry < 0) { // top overflow
|
||||
r.rh = r.rh+r.ry;
|
||||
r.ry = 0;
|
||||
} else if (r.ry > r.vp_b) { // and bottom
|
||||
r.rh = r.rh-r.vp_b;
|
||||
r.ry = r.vp_b;
|
||||
}
|
||||
}
|
||||
|
||||
that._rAdjustSizer();
|
||||
|
||||
w = r = null;
|
||||
}
|
||||
this._rOnWinMouseUp = function() {
|
||||
|
||||
// stop resize
|
||||
|
||||
var r = that.conf.resize;
|
||||
var w = that.wins.w[that._idd];
|
||||
|
||||
that.wins.conf.resize_actv = false;
|
||||
that.wins.vp.style.cursor = r.vp_cursor;
|
||||
|
||||
w.fr_cover.className = String(w.fr_cover.className).replace(/\s{0,}dhxwin_fr_cover_resize/gi,"");
|
||||
|
||||
if (r.resized) {
|
||||
that.wins._winSetSize(that._idd, r.rw, r.rh);
|
||||
if (r.rx == null) r.rx = w.conf.x;
|
||||
if (r.ry == null) r.ry = w.conf.y;
|
||||
if (r.rx != w.conf.x || r.ry != w.conf.y) that.wins._winSetPosition(that._idd, r.rx, r.ry);
|
||||
}
|
||||
|
||||
if (r.obj != null) {
|
||||
r.obj.parentNode.removeChild(r.obj);
|
||||
r.obj = null;
|
||||
}
|
||||
if (r.objFR != null) {
|
||||
r.objFR.parentNode.removeChild(r.objFR);
|
||||
r.objFR = null;
|
||||
}
|
||||
|
||||
if (typeof(window.addEventListener) == "function") {
|
||||
window.removeEventListener("mousemove", that._rOnWinMouseMove, false);
|
||||
window.removeEventListener("mouseup", that._rOnWinMouseUp, false);
|
||||
window.removeEventListener("selectstart", that._rOnSelectStart, false);
|
||||
} else {
|
||||
document.body.detachEvent("onmousemove", that._rOnWinMouseMove);
|
||||
document.body.detachEvent("onmouseup", that._rOnWinMouseUp);
|
||||
document.body.detachEvent("onselectstart", that._rOnSelectStart);
|
||||
}
|
||||
|
||||
if (r.resized) {
|
||||
if (that.dataType == "layout" && that.dataObj != null) that.dataObj.callEvent("onResize",[]); // deprecated, 3.6 compat
|
||||
that.wins._callMainEvent("onResizeFinish", that._idd);
|
||||
}
|
||||
|
||||
r.mode = "";
|
||||
|
||||
w = r = null;
|
||||
}
|
||||
|
||||
this._rOnSelectStart = function(e) {
|
||||
e = e||event;
|
||||
if (e.preventDefault) e.preventDefault(); else e.returnValue = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
this._rInitSizer = function() {
|
||||
|
||||
var r = that.conf.resize;
|
||||
var w = that.wins.w[that._idd];
|
||||
|
||||
r.obj = document.createElement("DIV");
|
||||
r.obj.className = "dhxwin_resize";
|
||||
r.obj.style.zIndex = w.win.style.zIndex;
|
||||
r.obj.style.cursor = r.mode+"-resize";
|
||||
that.wins.vp.appendChild(r.obj);
|
||||
|
||||
if (that.wins.conf.fr_cover == true) {
|
||||
r.objFR = document.createElement("IFRAME");
|
||||
r.objFR.className = "dhxwin_resize_fr_cover";
|
||||
r.objFR.style.zIndex = r.obj.style.zIndex;
|
||||
that.wins.vp.insertBefore(r.objFR, r.obj);
|
||||
}
|
||||
|
||||
r.rx = w.conf.x;
|
||||
r.ry = w.conf.y;
|
||||
r.rw = w.conf.w;
|
||||
r.rh = w.conf.h;
|
||||
r = null;
|
||||
}
|
||||
|
||||
this._rAdjustSizer = function() {
|
||||
var r = that.conf.resize;
|
||||
if (!r.obj) this._rInitSizer();
|
||||
// dim
|
||||
r.obj.style.width = r.rw+"px";
|
||||
r.obj.style.height = r.rh+"px";
|
||||
|
||||
// pos, optional
|
||||
if (r.rx != null) r.obj.style.left = r.rx+"px";
|
||||
if (r.ry != null) r.obj.style.top = r.ry+"px";
|
||||
|
||||
if (r.objFR != null) {
|
||||
r.objFR.style.width = r.obj.style.width;
|
||||
r.objFR.style.height = r.obj.style.height;
|
||||
if (r.rx != null) r.objFR.style.left = r.obj.style.left;
|
||||
if (r.ry != null) r.objFR.style.top = r.obj.style.top;
|
||||
}
|
||||
|
||||
r = null;
|
||||
}
|
||||
|
||||
if (typeof(window.addEventListener) == "function") {
|
||||
this.wins.w[this._idd].brd.addEventListener("mousemove", this._rOnCellMouseMove, false);
|
||||
this.wins.w[this._idd].brd.addEventListener("mousedown", this._rOnCellMouseDown, false);
|
||||
} else {
|
||||
this.wins.w[this._idd].brd.attachEvent("onmousemove", this._rOnCellMouseMove);
|
||||
this.wins.w[this._idd].brd.attachEvent("onmousedown", this._rOnCellMouseDown);
|
||||
}
|
||||
|
||||
this._unloadResize = function() {
|
||||
|
||||
if (typeof(window.addEventListener) == "function") {
|
||||
this.wins.w[this._idd].brd.removeEventListener("mousemove", this._rOnCellMouseMove, false);
|
||||
this.wins.w[this._idd].brd.removeEventListener("mousedown", this._rOnCellMouseDown, false);
|
||||
} else {
|
||||
this.wins.w[this._idd].brd.detachEvent("onmousemove", this._rOnCellMouseMove);
|
||||
this.wins.w[this._idd].brd.detachEvent("onmousedown", this._rOnCellMouseDown);
|
||||
}
|
||||
|
||||
this._initResize = null;
|
||||
this._rOnCellMouseMove = null;
|
||||
this._rOnCellMouseDown = null;
|
||||
this._rOnWinMouseMove = null;
|
||||
this._rOnWinMouseUp = null;
|
||||
this._rOnSelectStart = null;
|
||||
this._rInitSizer = null;
|
||||
this._rAdjustSizer = null;
|
||||
this._unloadResize = null;
|
||||
|
||||
this.conf.resize = null;
|
||||
that = null;
|
||||
};
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user