some more ipad fixed
This commit is contained in:
parent
291306f699
commit
aed8ec2580
7 changed files with 36 additions and 14 deletions
|
|
@ -253,8 +253,7 @@ canon.addCommand({
|
|||
canon.addCommand({
|
||||
name: "inserttext",
|
||||
exec: function(env, args, request) {
|
||||
env.editor.insert(lang.stringRepeat(args.text || "",
|
||||
args.times || 1));
|
||||
env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
overflow: hidden;
|
||||
|
||||
font-family: "Menlo", "Monaco", "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ace_scroller {
|
||||
|
|
@ -76,10 +76,13 @@
|
|||
.ace_editor textarea {
|
||||
position: fixed;
|
||||
z-index: -1;
|
||||
width: 10px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 60px;
|
||||
height: 30px;
|
||||
opacity: 0;
|
||||
background: transparent;
|
||||
webkit-appearance: none;
|
||||
appearance: none;
|
||||
border: none;
|
||||
resize: none;
|
||||
|
|
@ -97,7 +100,6 @@
|
|||
}
|
||||
|
||||
.ace_text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
color: black;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1091,7 +1091,7 @@ var EditSession = function(text, mode) {
|
|||
|
||||
if (!this.$useWrapMode) {
|
||||
str = this.getLine(row).substring(0, column);
|
||||
column = this.$getStringScreenWidth(str);
|
||||
column = this.$getStringScreenWidth(str);
|
||||
return {
|
||||
row: row,
|
||||
column: column
|
||||
|
|
|
|||
|
|
@ -45,8 +45,10 @@ require("pilot/fixoldbrowsers");
|
|||
var oop = require("pilot/oop");
|
||||
var event = require("pilot/event");
|
||||
var lang = require("pilot/lang");
|
||||
var useragent = require("pilot/useragent");
|
||||
var TextInput = require("ace/keyboard/textinput").TextInput;
|
||||
var MouseHandler = require("ace/mouse_handler").MouseHandler;
|
||||
var TouchHandler = require("ace/touch_handler").TouchHandler;
|
||||
var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Search = require("ace/search").Search;
|
||||
|
|
@ -62,7 +64,11 @@ var Editor =function(renderer, session) {
|
|||
this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
|
||||
this.keyBinding = new KeyBinding(this);
|
||||
|
||||
this.$mouseHandler = new MouseHandler(this);
|
||||
// TODO detect touch event support
|
||||
if (useragent.isIPad)
|
||||
this.$mouseHandler = new TouchHandler(this);
|
||||
else
|
||||
this.$mouseHandler = new MouseHandler(this);
|
||||
|
||||
this.$selectionMarker = null;
|
||||
this.$highlightLineMarker = null;
|
||||
|
|
@ -242,11 +248,13 @@ var Editor =function(renderer, session) {
|
|||
this.onFocus = function() {
|
||||
this.renderer.showCursor();
|
||||
this.renderer.visualizeFocus();
|
||||
this._dispatchEvent("focus");
|
||||
};
|
||||
|
||||
this.onBlur = function() {
|
||||
this.renderer.hideCursor();
|
||||
this.renderer.visualizeBlur();
|
||||
this._dispatchEvent("blur");
|
||||
};
|
||||
|
||||
this.onDocumentChange = function(e) {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
define(function(require, exports, module) {
|
||||
|
||||
var dom = require("pilot/dom");
|
||||
var useragent = require("pilot/useragent");
|
||||
|
||||
var Cursor = function(parentEl) {
|
||||
this.element = document.createElement("div");
|
||||
|
|
@ -78,7 +79,9 @@ var Cursor = function(parentEl) {
|
|||
|
||||
this.showCursor = function() {
|
||||
this.isVisible = true;
|
||||
this.element.appendChild(this.cursor);
|
||||
|
||||
if (!useragent.isIPad)
|
||||
this.element.appendChild(this.cursor);
|
||||
|
||||
var cursor = this.cursor;
|
||||
cursor.style.visibility = "visible";
|
||||
|
|
@ -132,7 +135,7 @@ var Cursor = function(parentEl) {
|
|||
this.cursor.style.width = config.characterWidth + "px";
|
||||
this.cursor.style.height = config.lineHeight + "px";
|
||||
|
||||
if (this.isVisible) {
|
||||
if (this.isVisible && !useragent.isIPad) {
|
||||
this.element.appendChild(this.cursor);
|
||||
}
|
||||
this.restartTimer();
|
||||
|
|
|
|||
|
|
@ -93,7 +93,8 @@ var Text = function(parentEl) {
|
|||
},
|
||||
|
||||
this.$measureSizes = function() {
|
||||
var n = 1000;
|
||||
var n = 500;
|
||||
var probe = "Xy";
|
||||
if (!this.$measureNode) {
|
||||
var measureNode = this.$measureNode = document.createElement("div");
|
||||
var style = measureNode.style;
|
||||
|
|
@ -109,7 +110,7 @@ var Text = function(parentEl) {
|
|||
// in FF 3.6 monospace fonts can have a fixed sub pixel width.
|
||||
// that's why we have to measure many characters
|
||||
// Note: characterWidth can be a float!
|
||||
measureNode.innerHTML = lang.stringRepeat("Xy", n);
|
||||
dom.setInnerText(measureNode, lang.stringRepeat(probe, n));
|
||||
document.body.insertBefore(measureNode, document.body.firstChild);
|
||||
}
|
||||
|
||||
|
|
@ -119,9 +120,10 @@ var Text = function(parentEl) {
|
|||
style[prop] = value;
|
||||
}
|
||||
|
||||
//console.log(this.$measureNode.offsetWidth / (n * probe.length))
|
||||
var size = {
|
||||
height: this.$measureNode.offsetHeight,
|
||||
width: this.$measureNode.offsetWidth / (n * 2)
|
||||
width: this.$measureNode.offsetWidth / (n * probe.length)
|
||||
};
|
||||
return size;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -313,8 +313,16 @@ var VirtualRenderer = function(container, theme) {
|
|||
var bounds = this.content.getBoundingClientRect();
|
||||
var offset = (this.layerConfig && this.layerConfig.offset) || 0;
|
||||
|
||||
textarea.style.left = (bounds.left + pos.left + this.$padding) + "px";
|
||||
textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
|
||||
var left = bounds.left + pos.left + this.$padding;
|
||||
var top = bounds.top + pos.top - this.scrollTop + offset;
|
||||
|
||||
if (useragent.isIPad) {
|
||||
left -= 3;
|
||||
top -= 0;
|
||||
}
|
||||
|
||||
textarea.style.left = left + "px";
|
||||
textarea.style.top = top + "px";
|
||||
};
|
||||
|
||||
this.getFirstVisibleRow = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue