Compare commits
10 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab70b55316 | ||
|
|
fbdfaaf0fc | ||
|
|
1d05dc78be | ||
|
|
0ca1e2cf2d | ||
|
|
1b8ea9a48e | ||
|
|
4315fd36cf | ||
|
|
b3b26a311b | ||
|
|
ff7c1b5182 | ||
|
|
c50a765176 | ||
|
|
fcc37e2068 |
7 changed files with 92 additions and 64 deletions
|
|
@ -2,8 +2,8 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
font-family: "Menlo", "Monaco", "Courier New", monospace;
|
font-family: "Droid Sans Mono", "Monaco", "Courier New", monospace;
|
||||||
font-size: 12px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_scroller {
|
.ace_scroller {
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_text-layer {
|
.ace_text-layer {
|
||||||
font-family: Monaco, "Courier New", monospace;
|
font-family: "Droid Sans Mono", Monaco, "Courier New", monospace;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ var EditSession = function(text, mode) {
|
||||||
return this.doc.getNewLineMode();
|
return this.doc.getNewLineMode();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$useWorker = true;
|
this.$useWorker = false;
|
||||||
this.setUseWorker = function(useWorker) {
|
this.setUseWorker = function(useWorker) {
|
||||||
if (this.$useWorker == useWorker)
|
if (this.$useWorker == useWorker)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,7 @@ var Editor =function(renderer, session) {
|
||||||
|
|
||||||
this.resize = function() {
|
this.resize = function() {
|
||||||
this.renderer.onResize();
|
this.renderer.onResize();
|
||||||
|
this.renderer.$textLayer.$pollSizeChanges();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.setTheme = function(theme) {
|
this.setTheme = function(theme) {
|
||||||
|
|
@ -528,7 +529,7 @@ var Editor =function(renderer, session) {
|
||||||
return this.$highlightActiveLine;
|
return this.$highlightActiveLine;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$highlightSelectedWord = true;
|
this.$highlightSelectedWord = false;
|
||||||
this.setHighlightSelectedWord = function(shouldHighlight) {
|
this.setHighlightSelectedWord = function(shouldHighlight) {
|
||||||
if (this.$highlightSelectedWord == shouldHighlight)
|
if (this.$highlightSelectedWord == shouldHighlight)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,13 @@ var TextInput = function(parentNode, host) {
|
||||||
|
|
||||||
var text = dom.createElement("textarea");
|
var text = dom.createElement("textarea");
|
||||||
text.style.left = "-10000px";
|
text.style.left = "-10000px";
|
||||||
|
// We have too many moving parts in the iPad, so we set the text
|
||||||
|
// positioning to absolute to be able to calculate the precise position for
|
||||||
|
// cursor. Otherwise the cursor position would be relative to the screen
|
||||||
|
// coordinates (position: fixed).
|
||||||
|
if (useragent.isIPad)
|
||||||
|
text.style.position = "absolute";
|
||||||
|
|
||||||
parentNode.appendChild(text);
|
parentNode.appendChild(text);
|
||||||
|
|
||||||
var PLACEHOLDER = String.fromCharCode(0);
|
var PLACEHOLDER = String.fromCharCode(0);
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
|
|
||||||
var dom = require("pilot/dom");
|
var dom = require("pilot/dom");
|
||||||
|
var useragent = require("pilot/useragent");
|
||||||
|
|
||||||
var Cursor = function(parentEl) {
|
var Cursor = function(parentEl) {
|
||||||
this.element = dom.createElement("div");
|
this.element = dom.createElement("div");
|
||||||
|
|
@ -68,8 +69,10 @@ var Cursor = function(parentEl) {
|
||||||
|
|
||||||
this.showCursor = function() {
|
this.showCursor = function() {
|
||||||
this.isVisible = true;
|
this.isVisible = true;
|
||||||
|
if (!useragent.isIPad)
|
||||||
this.element.appendChild(this.cursor);
|
this.element.appendChild(this.cursor);
|
||||||
|
|
||||||
|
|
||||||
var cursor = this.cursor;
|
var cursor = this.cursor;
|
||||||
cursor.style.visibility = "visible";
|
cursor.style.visibility = "visible";
|
||||||
this.restartTimer();
|
this.restartTimer();
|
||||||
|
|
@ -120,7 +123,7 @@ var Cursor = function(parentEl) {
|
||||||
this.cursor.style.width = config.characterWidth + "px";
|
this.cursor.style.width = config.characterWidth + "px";
|
||||||
this.cursor.style.height = config.lineHeight + "px";
|
this.cursor.style.height = config.lineHeight + "px";
|
||||||
|
|
||||||
if (this.isVisible) {
|
if (this.isVisible && !useragent.isIPad) {
|
||||||
this.element.appendChild(this.cursor);
|
this.element.appendChild(this.cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
/* vim:ts=4:sts=4:sw=4:
|
/* vim:ts=4:sts=4:sw=4:
|
||||||
|
*
|
||||||
* ***** BEGIN LICENSE BLOCK *****
|
* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
|
|
@ -77,13 +78,13 @@ var Text = function(parentEl) {
|
||||||
|
|
||||||
this.$pollSizeChanges = function() {
|
this.$pollSizeChanges = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
setInterval(function() {
|
//setInterval(function() {
|
||||||
var size = self.$measureSizes();
|
var size = self.$measureSizes();
|
||||||
if (self.$characterSize.width !== size.width || self.$characterSize.height !== size.height) {
|
if (self.$characterSize.width !== size.width || self.$characterSize.height !== size.height) {
|
||||||
self.$characterSize = size;
|
self.$characterSize = size;
|
||||||
self._dispatchEvent("changeCharaterSize", {data: size});
|
self._dispatchEvent("changeCharaterSize", {data: size});
|
||||||
}
|
}
|
||||||
}, 500);
|
//}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$fontStyles = {
|
this.$fontStyles = {
|
||||||
|
|
|
||||||
|
|
@ -319,23 +319,39 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getTextAreaContainer = function() {
|
this.getTextAreaContainer = function() {
|
||||||
return this.container;
|
// Let's make it play nice wit iPad. Otherwise the default padding of
|
||||||
|
// the container will make the cursor shift to the left.
|
||||||
|
return useragent.isIPad ? this.content : this.container;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.moveTextAreaToCursor = function(textarea) {
|
this.moveTextAreaToCursor = function(textarea) {
|
||||||
// in IE the native cursor always shines through
|
if (!this.layerConfig)
|
||||||
if (useragent.isIE)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var pos = this.$cursorLayer.getPixelPosition();
|
var pos, left, top;
|
||||||
|
if (useragent.isIPad) {
|
||||||
|
pos = this.$cursorLayer.getPixelPosition(true);
|
||||||
|
if (!pos)
|
||||||
|
return;
|
||||||
|
|
||||||
|
left = pos.left + this.$padding - 3;
|
||||||
|
top = pos.top;
|
||||||
|
} else {
|
||||||
|
pos = this.$cursorLayer.getPixelPosition();
|
||||||
if (!pos)
|
if (!pos)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var bounds = this.content.getBoundingClientRect();
|
var bounds = this.content.getBoundingClientRect();
|
||||||
var offset = (this.layerConfig && this.layerConfig.offset) || 0;
|
var offset = this.layerConfig.offset;
|
||||||
|
|
||||||
textarea.style.left = (bounds.left + pos.left + this.$padding) + "px";
|
left = bounds.left + pos.left + this.$padding;
|
||||||
textarea.style.top = (bounds.top + pos.top - this.scrollTop + offset) + "px";
|
top = bounds.top + pos.top - this.scrollTop + offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea.style.left = left + "px";
|
||||||
|
textarea.style.top = top + "px";
|
||||||
|
textarea.style.lineHeight = this.layerConfig.lineHeight + "px";
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getFirstVisibleRow = function() {
|
this.getFirstVisibleRow = function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue