Folks,
At what point in the build out of the canvas with an SVG file loaded is the
TextSelectionManager available? I'm getting an NPE at the last line of this
code, I'm assuming because it's too early in the process,
SelectionListener sl = new SelectionListener(){
public void selectionChanged(SelectionEvent arg0) {
log.debug("SelectionListener - Selection Changed");
}
public void selectionCleared(SelectionEvent arg0) {
log.debug("SelectionListener - Selection Changed");
}
public void selectionDone(SelectionEvent arg0) {
log.debug("SelectionListener - Selection Changed");
}
public void selectionStarted(SelectionEvent arg0) {
log.debug("SelectionListener - Selection Changed");
}};
tsm = svgCanvas.getTextSelectionManager();
tsm.addSelectionListener(sl);
Thanks,
K. W. Landry
Thomas DeWeese wrote:
Hi Keith,
Keith Mayfield wrote:
After a user has selected some text on the JSVGCanvas,
which api's would give me the text that has been
selected. Some sample code would be great!!!
Well the short answer is that it isn't that easy :/
I just delivered an update to CVS.
This is now much easier, you can now access the TextSelectionManager
from the JSVGCanavas. This lets you do one of two things,
first you can register a selection listener and be notified as
the selection changes, or the SelectionManager has a 'getSelection'
method that returns the current selection (if any).
canvas.getTextSelectionManager().getSelection();