Fix resizing macro dialog

This commit is contained in:
Julia Radzhabova
2024-12-20 12:49:39 +03:00
parent a9cb207d43
commit cb573d1052
5 changed files with 13 additions and 65 deletions

View File

@ -116,13 +116,6 @@ define([], function () {
case 'aceEditorReady':
this.fireEvent('ready', cmd.data);
break;
case 'mouseUp':
case 'mouseMove':
var offset = Common.Utils.getOffset(this.parentEl);
var x = cmd.data.x * Common.Utils.zoom() + offset.left,
y = cmd.data.y * Common.Utils.zoom() + offset.top;
this.fireEvent(cmd.command.toLowerCase(), x, y);
break;
}
}
},
@ -160,6 +153,10 @@ define([], function () {
});
},
enablePointerEvents: function(enable) {
this.iframe && (this.iframe.style.pointerEvents = enable ? "" : "none");
},
destroyEditor: function() {
this._unbindWindowEvents();
}

View File

@ -110,7 +110,15 @@ define([], function () {
isFunctionsSupport: this._state.isFunctionsSupport,
});
this.on('help', this.onHelp);
this.on({
'help': this.onHelp,
'drag': function(args){
args[0].codeEditor && args[0].codeEditor.enablePointerEvents(args[1]!=='start');
},
'resize': function(args){
args[0].codeEditor && args[0].codeEditor.enablePointerEvents(args[1]!=='start');
}
});
Common.UI.Window.prototype.initialize.call(this, _options);
},
@ -266,14 +274,6 @@ define([], function () {
selectedItem.set('value', value);
}
});
this.codeEditor.on('mouseup', function(x, y) {
if (me.binding.dragStop) me.binding.dragStop();
if (me.binding.resizeStop) me.binding.resizeStop();
});
this.codeEditor.on('mousemove', function(x, y) {
if (me.binding.drag) me.binding.drag({ pageX: x, pageY: y });
if (me.binding.resize) me.binding.resize({ pageX: x, pageY: y });
});
},
setListMacros: function() {

View File

@ -5,8 +5,6 @@
* events: {
* onChangeValue // text in editor is changed
* onEditorReady // editor is ready for use
* onMouseUp
* onMouseMove
* onLoad // frame with editor is loaded
* }
* }
@ -81,16 +79,6 @@
handler = events['onEditorReady'];
data = cmd.data;
break;
case 'mouseUp':
case 'mouseMove':
handler = events[cmd.command==='mouseUp' ? 'onMouseUp' : 'onMouseMove'];
var rect = parentEl.getBoundingClientRect(),
offset = {
top: rect.top + window.pageYOffset,
left: rect.left + window.pageXOffset
};
data = [cmd.data.x + offset.left, cmd.data.y + offset.top]
break;
}
if (handler && typeof handler == "function") {
res = handler.call(_self, {target: _self, data: data});

View File

@ -264,36 +264,9 @@ var _postMessage = function(msg) {
};
var fn = function(e) { _onMessage(e); };
var onMouseUp = function(e) {
_postMessage({
command: 'mouseUp',
data: {
x: (undefined === e.clientX) ? e.pageX : e.clientX,
y: (undefined === e.clientY) ? e.pageY : e.clientY
},
referer: 'ace-editor'
});
};
var onMouseMove = function(e) {
_postMessage({
command: 'mouseMove',
data: {
x: (undefined === e.clientX) ? e.pageX : e.clientX,
y: (undefined === e.clientY) ? e.pageY : e.clientY
},
referer: 'ace-editor'
});
};
if (window.attachEvent) {
window.attachEvent('onmessage', fn);
window.attachEvent("onmouseup", onMouseUp);
window.attachEvent("onmousemove", onMouseMove);
} else {
window.addEventListener('message', fn, false);
window.addEventListener("mouseup", onMouseUp, false);
window.addEventListener("mousemove", onMouseMove, false);
}
})(window, undefined);

View File

@ -65,14 +65,6 @@
);
};
var onMouseUp = function (event) {
console.log("onMouseUp");
};
var onMouseMove = function (event) {
console.log("onMouseMove");
};
var onLoad = function (event) {
console.log("onLoad");
};
@ -82,8 +74,6 @@
events: {
onChangeValue: onChangeValue,
onEditorReady: onEditorReady,
onMouseUp: onMouseUp,
onMouseMove: onMouseMove,
onLoad: onLoad
}
};