Adapt highlighting of objects: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 1: Line 1:
<html>
<div id="myinfobox"
    style="
        display:block;
        position:absolute;
        background-color:#ffff88;
        padding:10px;
        /* Cross-browser opacity:*/
        -ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=50)';
        filter: alpha(opacity=50);
        opacity:.5;
    "
></div>
</html>
<jsxgraph width="600" height="600">
<jsxgraph width="600" height="600">
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5, 5, 5, -5], grid: false});
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5, 5, 5, -5], grid: false});
var infobox = brd.create('text',[0,0,'xxx'],{visible:false});
var p1 = brd.create('point',[3,0]);
var p1 = brd.create('point',[3,0]);
var p2 = brd.create('point',[-1,0]);
var p2 = brd.create('point',[-1,0]);
Line 9: Line 22:


var c = brd.create('circle',[p2,p3]);
var c = brd.create('circle',[p2,p3]);
 
/*
var infobox = document.getElementById('myinfobox');
JXG.Line.prototype.highlight = function(){
JXG.Line.prototype.highlight = function(){
     infobox.coords = new JXG.Coords(JXG.COORDS_BY_SCREEN,[this.board.mousePosRel[0]+20,this.board.mousePosRel[1]+20], this.board);
     infobox.innerHTML = this.name;
     infobox.setText(this.board.mousePosRel.toString());
    infobox.style.left = this.board.mousePosAbs[0]+20;
     infobox.setProperty({visible:true});
     infobox.style.top = this.board.mousePosAbs[1]-20;
    infobox.update();
     infobox.style.display = 'block';
}
}
JXG.Line.prototype.noHighlight = function(){
JXG.Line.prototype.noHighlight = function(){
     infobox.setProperty({visible:false});
     infobox.style.display = 'block';
}
}
c.highlight = function(){
c.highlight = function(){
     infobox.coords = new JXG.Coords(JXG.COORDS_BY_SCREEN,[this.board.mousePosRel[0]+20,this.board.mousePosRel[1]+20], this.board);
     infobox.innerHTML = 'circle '+this.name;
     infobox.setText(this.board.mousePosRel.toString());
    infobox.style.left = this.board.mousePosAbs[0]+20;
     infobox.setProperty({visible:true});
     infobox.style.top = this.board.mousePosAbs[1]-20;
    infobox.update();
     infobox.style.display = 'block';
}
}
c.noHighlight = function(){
c.noHighlight = function(){
     infobox.setProperty({visible:false});
     infobox.style.display = 'none';
}
}
 
*/
</jsxgraph>
</jsxgraph>



Revision as of 16:40, 18 December 2009

The JavaScript code