mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
js xps external and internal links
This commit is contained in:
@ -381,6 +381,21 @@ window.onload = function()
|
||||
{
|
||||
this.file.getGlyphs(pageIndex, width, height);
|
||||
};
|
||||
|
||||
this.getExternalLinks = function(pageIndex, width, height)
|
||||
{
|
||||
var res = this.file.getExtLinks(pageIndex, width, height);
|
||||
return res;
|
||||
};
|
||||
|
||||
this.getInternalLinks = function(pageIndex, width, height)
|
||||
{
|
||||
var res = this.file.getIntLinks(pageIndex, width, height);
|
||||
return res;
|
||||
};
|
||||
|
||||
this.ext = null;
|
||||
this.Int = null;
|
||||
|
||||
this._paint = function()
|
||||
{
|
||||
@ -462,6 +477,10 @@ window.onload = function()
|
||||
{
|
||||
page.Image = this.file.getPage(i, w, h);
|
||||
this.getGlyphs(i, w, h);
|
||||
this.ext = this.getExternalLinks(i, w, h);
|
||||
this.ext.Page = i;
|
||||
this.Int = this.getInternalLinks(i, w, h);
|
||||
this.Int.Page = i;
|
||||
}
|
||||
|
||||
let x = ((xCenter * this.retinaPixelRatio) >> 0) - (w >> 1);
|
||||
@ -471,6 +490,25 @@ window.onload = function()
|
||||
if (this.Selection.page == i && this.Selection.IsSelection)
|
||||
ctx.drawImage(this.Selection.Image, 0, 0, w, h, x, y, w, h);
|
||||
|
||||
if (this.ext && this.ext.Page == i)
|
||||
{
|
||||
ctx.fillStyle = "#FF0000";
|
||||
for (let j = 0; j < this.ext.length; j++)
|
||||
{
|
||||
let Link = this.ext[j];
|
||||
ctx.fillRect(x + Link.X, y + Link.Y, Link.W, Link.H);
|
||||
}
|
||||
}
|
||||
if (this.Int && this.Int.Page == i)
|
||||
{
|
||||
ctx.fillStyle = "#00FF00";
|
||||
for (let j = 0; j < this.Int.length; j++)
|
||||
{
|
||||
let Link = this.Int[j];
|
||||
ctx.fillRect(x + Link.X, y + Link.Y, Link.W, Link.H);
|
||||
}
|
||||
}
|
||||
|
||||
ctx.strokeRect(x + lineW / 2, y + lineW / 2, w - lineW, h - lineW);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user