(private) new TPadPainter(dom, pad, iscanopt)
Painter for TPad object
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dom |
object | string | DOM element for drawing or element id |
|
pad |
object | TPad object to draw |
|
iscan |
boolean |
<optional> |
if TCanvas object |
Methods
(private) addObjectPainter()
Add object painter to list of primitives
- Source:
(private) addPadBorder()
Add border decorations
- Source:
(private) addPadButton()
Add button to the pad
- Source:
(private) addPadButtons()
Add buttons for pad or canvas
- Source:
(private) addPadInteractive()
Add pad interactive features like dragging and resize
- Source:
(async, private) buildLegend()
add legend object to the pad and redraw it
- Source:
(private) changeDarkMode()
Changes canvas dark mode
- Source:
checkCanvasResize() → {Promise}
Check resize of canvas
- Source:
Returns:
with result or false
- Type
- Promise
checkSpecial() → {boolean}
Check if it is special object, which should be handled separately
- Description:
It can be TStyle or list of colors or palette object
- Source:
Returns:
true if any
- Type
- boolean
checkSpecialsInPrimitives()
Check if special objects appears in primitives
- Description:
it could be list of colors or palette
- Source:
cleanPrimitives()
Cleanup primitives from pad - selector lets define which painters to remove
- Source:
Returns:
true if any painter was removed
cleanup()
cleanup pad and all primitives inside
- Source:
clickPadButton()
Process pad button click
- Source:
(private) confirmDraw()
confirms that drawing is completed, may trigger next drawing immediately
- Source:
createCanvasSvg()
Create SVG element for canvas
- Source:
(async, private) createImage() → {Promise}
Create image for the pad
- Description:
Used with web-based canvas to create images for server side
- Source:
Returns:
with image data, coded with btoa() function
- Type
- Promise
createPadSvg()
Create main SVG element for pad
- Source:
Returns:
true when pad is displayed and all its items should be redrawn
(private) decodeOptions()
Decode pad draw options
- Source:
(private) deliverWebCanvasEvent()
Deliver mouse move or click event to the web canvas
- Source:
disablePadDrawing()
Disable pad drawing
- Description:
Complete SVG element will be hidden
- Source:
(async, private) divide() → {Promise}
Divide pad on sub-pads
- Source:
Returns:
when finished
- Type
- Promise
(private) doingDraw()
indicates if painter performing objects draw
- Source:
(private) drawActiveBorder()
Draw pad active border
- Source:
(private) drawItemNameOnCanvas()
Draw item name on canvas if gStyle.fOptFile is configured
- Source:
(async, private) drawNextSnap() → {Promise}
Function called when drawing next snapshot from the list
- Source:
Returns:
for drawing of the snap
- Type
- Promise
(async) drawObject()
Draw single primitive
- Source:
(async, private) drawPrimitives() → {Promise}
Draw pad primitives
- Source:
Returns:
when drawing completed
- Type
- Promise
enlargePad()
Enlarge pad draw element when possible
- Source:
(private) fillContextMenu()
Fill pad context menu
- Source:
findActivePad() → {Object}
Search active pad
- Source:
Returns:
pad painter for active pad
- Type
- Object
(private) findInPrimitives()
try to find object by name in list of pad primitives
- Description:
used to find title drawing
- Source:
(private) findPainterFor(selobj, selnameopt, seltypeopt) → {object}
Try to find painter for specified object
- Description:
can be used to find painter for some special objects, registered as histogram functions
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
selobj |
object | object to which painter should be search, set null to ignore parameter |
|
selname |
string |
<optional> |
object name, set to null to ignore |
seltype |
string |
<optional> |
object type, set to null to ignore |
Returns:
- painter for specified object (if any)
- Type
- object
(private) findSnap()
Return painter with specified id
- Source:
(private) forEachPainterInPad(userfunc, kind)
Call function for each painter in pad
- Source:
Parameters:
Name | Type | Description |
---|---|---|
userfunc |
function | function to call |
kind |
string | 'all' for all objects (default), 'pads' only pads and sub-pads, 'objects' only for object in current pad |
(private) getAutoColor()
Provides automatic color
- Description:
Uses ROOT colors palette if possible
- Source:
(private) getCustomPalette()
returns custom palette associated with pad or top canvas
- Source:
(private) getFramePainter()
Returns frame painter inside the pad
- Source:
getFrameRect()
Returns frame coordinates - also when frame is not drawn
- Source:
(private) getMainPainter()
Returns main painter on the pad
- Description:
Typically main painter is TH1/TH2 object which is drawing axes
- Source:
(private) getNumPainters()
Returns number of painters
- Source:
getPadHeight()
get pad height
- Source:
getPadLog()
return pad log state x or y are allowed
- Source:
(private) getPadRanges()
returns actual ranges in the pad, which can be applied to the server
- Source:
getPadRect()
get pad rect
- Source:
getPadScale()
get pad height
- Source:
getPadWidth()
get pad width
- Source:
getRootPad()
return RPad object
- Source:
(private) getSubPadPainter()
Return sub-pads painter, only direct childs are checked
- Source:
(private) getWebPadOptions()
Collects pad information for TWebCanvas
- Description:
need to update different states
- Source:
hasObjectsToDraw()
Return true if any objects beside sub-pads exists in the pad
- Source:
(private) isBatchMode()
Indicates that drawing runs in batch mode
- Source:
isButton()
Returns true if button
- Source:
(private) isDefaultPadRange()
Returns true if default pad range is configured
- Source:
isEditable()
Returns true if pad is editable
- Source:
(private) isGrayscale()
Returns true if canvas configured with grayscale
- Source:
isPadEnlarged()
Return true if this pad enlarged
- Source:
(private) isRoot6()
Indicates that is is Root6 pad painter
- Source:
(private) itemContextMenu()
Show context menu for specified item
- Source:
(private) needRedrawByResize()
Checks if pad should be redrawn by resize
- Source:
(async, private) padContextMenu()
Show pad context menu
- Source:
(private) processPadTooltipEvent()
Process tooltip event in the pad
- Source:
(private) processSnapColors()
Process snap with colors
- Source:
(private) processSnapFont()
Process snap with custom font
- Source:
(private) processSnapStyle()
Process snap with style
- Source:
(private) processSpecialSnaps() → {Promise}
Process special snaps like colors or style objects
- Source:
Returns:
index where processing should start
- Type
- Promise
(async) produceImage() → {Promise}
Produce image for the pad
- Source:
Returns:
with created image
- Type
- Promise
(private) producePadEvent()
Generate pad events, normally handled by GED
- Description:
in pad painter, while pad may be drawn without canvas
- Source:
redraw()
redraw pad
- Source:
(async, private) redrawLegend()
Redraw TLegend object
- Description:
Used when object attributes are changed to ensure that legend is up to date
- Source:
(async) redrawPad() → {Promise}
Redraw pad means redraw ourself
- Source:
Returns:
when redrawing ready
- Type
- Promise
(async, private) redrawPadSnap() → {Promise}
Redraw pad snap
- Description:
Online version of drawing pad primitives for the canvas snapshot contains list of objects as first entry, graphical properties of canvas itself is provided in ROOT6 it also includes primitives, but we ignore them
- Source:
Returns:
with pad painter when drawing completed
- Type
- Promise
registerForPadEvents()
register for pad events receiver
- Description:
in pad painter, while pad may be drawn without canvas
- Source:
(private) removePrimitive()
Removes and cleanup specified primitive
- Description:
also secondary primitives will be removed
- Source:
Returns:
new index to continue loop or -111 if main painter removed
saveAs(kind, full_canvas, filenameopt)
Save pad as image
- Description:
Normally used from context menu
- Source:
Example
import { getElementCanvPainter } from 'https://root.cern/js/latest/modules/base/ObjectPainter.mjs';
let canvas_painter = getElementCanvPainter('drawing_div_id');
canvas_painter.saveAs('png', true, 'canvas.png');
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
kind |
string | format of saved image like 'png', 'svg' or 'jpeg' |
|
full_canvas |
boolean | does complete canvas (true) or only frame area (false) should be saved |
|
filename |
string |
<optional> |
name of the file which should be stored |
selectObjectPainter()
method redirect call to pad events receiver
- Source:
(private) setFastDrawing()
Set fast drawing property depending on the size
- Source:
(private) setGrayscale()
Set grayscale mode for the canvas
- Source:
(private) setMainPainter()
Assign main painter on the pad
- Description:
Typically main painter is TH1/TH2 object which is drawing axes
- Source:
(private) showPadButtons()
Show pad buttons
- Source:
(private) svg_this_pad()
Returns SVG element for the pad itself
- Source:
(private) syncDraw(kind) → {Promise}
sync drawing/redrawing/resize of the pad
- Source:
Parameters:
Name | Type | Description |
---|---|---|
kind |
string | kind of draw operation, if true - always queued |
Returns:
when pad is ready for draw operation or false if operation already queued
- Type
- Promise
updateObject()
Update TPad object
- Source:
(async, static) draw()
draw TPad object
- Source: