initialize with internal dict

a plotter initialized with no 'dict' now makes an empty internal dict so that one can use 'setPoint' and 'addPoint' right off the bat
nix
Ted Moore 4 years ago
parent 4096ff836b
commit 511a8d19d4

@ -34,6 +34,7 @@ FluidPlotter {
ymax = ymax_; ymax = ymax_;
this.createCatColors; this.createCatColors;
dict_internal = Dictionary.new;
if(dict_.notNil,{this.dict_(dict_)}); if(dict_.notNil,{this.dict_(dict_)});
this.createPlotWindow(bounds,parent_,mouseMoveAction,dict_); this.createPlotWindow(bounds,parent_,mouseMoveAction,dict_);
} }
@ -47,7 +48,7 @@ FluidPlotter {
categories_ { categories_ {
arg labelSetDict; arg labelSetDict;
if(dict_internal.notNil,{ if(dict_internal.size == 0,{
var label_to_int = Dictionary.new; var label_to_int = Dictionary.new;
var counter = 0; var counter = 0;
dict_internal.keysValuesDo({ dict_internal.keysValuesDo({
@ -98,7 +99,9 @@ FluidPlotter {
setPoint_ { setPoint_ {
arg identifier, x, y, color, size = 1; arg identifier, x, y, color, size = 1;
dict_internal.put(identifier,FluidPlotterPoint(identifier,x,y,color ? Color.black,size)); dict_internal.put(identifier,FluidPlotterPoint(identifier,x,y,color ? Color.black,size));
this.refresh; this.refresh;
} }

Loading…
Cancel
Save