size multiline markers with "right" instead of "width"
This commit is contained in:
parent
7f8892f9a5
commit
dbe4d0531e
1 changed files with 12 additions and 16 deletions
|
|
@ -73,7 +73,7 @@ var Marker = function(parentEl) {
|
|||
|
||||
|
||||
var html = [];
|
||||
for ( var key in this.markers) {
|
||||
for (var key in this.markers) {
|
||||
var marker = this.markers[key];
|
||||
|
||||
if (!marker.range) {
|
||||
|
|
@ -140,29 +140,25 @@ var Marker = function(parentEl) {
|
|||
}
|
||||
};
|
||||
|
||||
// Draws a multi line marker, where lines span the full width
|
||||
this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, type) {
|
||||
// Draws a multi line marker, where lines span the full width
|
||||
this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, type) {
|
||||
var padding = type === "background" ? 0 : this.$padding;
|
||||
var layerWidth = layerConfig.width + 2 * this.$padding - padding;
|
||||
// from selection start to the end of the line
|
||||
var height = layerConfig.lineHeight;
|
||||
var width = Math.round(layerWidth - (range.start.column * layerConfig.characterWidth));
|
||||
var top = this.$getTop(range.start.row, layerConfig);
|
||||
var left = Math.round(
|
||||
padding + range.start.column * layerConfig.characterWidth
|
||||
);
|
||||
var height = config.lineHeight;
|
||||
var top = this.$getTop(range.start.row, config);
|
||||
var left = Math.round(padding + range.start.column * config.characterWidth);
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, " start' style='",
|
||||
"height:", height, "px;",
|
||||
"width:", width, "px;",
|
||||
"right:0;",
|
||||
"top:", top, "px;",
|
||||
"left:", left, "px;'></div>"
|
||||
);
|
||||
|
||||
// from start of the last line to the selection end
|
||||
top = this.$getTop(range.end.row, layerConfig);
|
||||
width = Math.round(range.end.column * layerConfig.characterWidth);
|
||||
top = this.$getTop(range.end.row, config);
|
||||
var width = Math.round(range.end.column * config.characterWidth);
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, "' style='",
|
||||
|
|
@ -173,15 +169,15 @@ var Marker = function(parentEl) {
|
|||
);
|
||||
|
||||
// all the complete lines
|
||||
height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
|
||||
height = (range.end.row - range.start.row - 1) * config.lineHeight;
|
||||
if (height < 0)
|
||||
return;
|
||||
top = this.$getTop(range.start.row + 1, layerConfig);
|
||||
top = this.$getTop(range.start.row + 1, config);
|
||||
|
||||
stringBuilder.push(
|
||||
"<div class='", clazz, "' style='",
|
||||
"height:", height, "px;",
|
||||
"width:", layerWidth, "px;",
|
||||
"right:0;",
|
||||
"top:", top, "px;",
|
||||
"left:", padding, "px;'></div>"
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue