Best JavaScript code snippet using stryker-parent
GlossyCircularGaugeBase.js.uncompressed.js
Source:GlossyCircularGaugeBase.js.uncompressed.js
1define("dojox/gauges/GlossyCircularGaugeBase", ["dojo/_base/declare","dojo/_base/lang","dojo/_base/connect","dojox/gfx","./AnalogGauge","./AnalogCircleIndicator","./TextIndicator","./GlossyCircularGaugeNeedle"],2function(declare, lang, connect, gfx, AnalogGauge, AnalogCircleIndicator, TextIndicator, GlossyCircularGaugeNeedle) {3return declare("dojox.gauges.GlossyCircularGaugeBase", [AnalogGauge], {4 // summary:5 // The base class for GlossyCircularGauge and GlossySemiCircularGauge.6 7 8 //_defaultIndicator : _Indicator9 // the type of default indicator to create10 _defaultIndicator: AnalogCircleIndicator,11 12 // _needle: dojox.gauges.GlossyCircularGaugeNeedle13 // the needle of this circular gauge14 _needle: null,15 16 // _textIndicator: dojox.gauges.TextIndicator17 // the text displaying the gauge's value18 _textIndicator: null,19 20 _textIndicatorAdded: false,21 22 // _range: Object23 // the range of this gauge24 _range: null,25 26 // value: Number27 // The value of the gauge.28 value: 0,29 30 // color: String31 // The main color of the gauge.32 color: 'black',33 34 // needleColor: Color35 // The main color of the needle.36 needleColor: '#c4c4c4',37 38 // textIndicatorFont: String39 // The font of the text indicator40 textIndicatorFont: "normal normal normal 20pt serif",41 42 // textIndicatorVisible: Boolean43 // Indicates if the text indicator is visible44 textIndicatorVisible: true,45 46 // textIndicatorColor: Color47 // The color of the text indicator48 textIndicatorColor: '#c4c4c4',49 50 // _majorTicksOffset: Number51 // Distance, at design, from gauge's center to major ticks52 _majorTicksOffset: 130,53 54 // majorTicksInterval: Number55 // Interval between major ticks56 majorTicksInterval: 10,57 58 // _majorTicksLength: Number59 // Major tick size, at design60 _majorTicksLength: 5,61 62 // majorTicksColor: Color63 // Color of major tick marks64 majorTicksColor: '#c4c4c4',65 66 // majorTicksLabelPlacement: String67 // Placement of major tick labels68 majorTicksLabelPlacement: 'inside',69 70 // _minorTicksOffset: Number71 // Distance, at design, from gauge's center to minor ticks72 _minorTicksOffset: 130,73 74 // minorTicksInterval: Number75 // Interval between minor ticks76 minorTicksInterval: 5,77 78 // _minorTicksLength: Number79 // Minor tick size, at design80 _minorTicksLength: 3,81 82 // minorTicksColor: Color83 // Color of minor tick marks84 minorTicksColor: '#c4c4c4',85 86 // noChange: Boolean87 // Indicates if the gauge reacts to touch events88 noChange: false,89 90 // title: String91 // The title displayed in the needle's tooltip92 title: "",93 94 // font: Object95 // The font of the gauge96 font: "normal normal normal 10pt serif",97 98 // scalePrecision: Number99 // The precision for the formatting of numbers in the scale (default is 0)100 scalePrecision: 0,101 102 // textIndicatorPrecision: Number103 // The precision for the formatting of numbers in the text indicator (default is 0)104 textIndicatorPrecision: 0,105 106 _font: null,107 108 109 constructor: function(){110 this.startAngle = -135;111 this.endAngle = 135;112 this.min = 0;113 this.max = 100;114 },115 116 startup: function(){117 // summary:118 // Overrides AnalogGauge.startup119 this.inherited(arguments);120 121 //just in case someone calls the startup twice.122 if (this._needle) return; 123 124 var scale = Math.min((this.width / this._designWidth), (this.height / this._designHeight));125 this.cx = scale * this._designCx + (this.width - scale * this._designWidth) / 2;126 this.cy = scale * this._designCy + (this.height - scale * this._designHeight) / 2;127 128 this._range = {129 low: this.min ? this.min : 0,130 high: this.max ? this.max : 100,131 color: [255, 255, 255, 0]132 };133 this.addRange(this._range);134 135 this._majorTicksOffset = this._minorTicksOffset = scale * this._majorTicksOffset;136 this._majorTicksLength = scale * this._majorTicksLength;137 this._minorTicksLength = scale * this._minorTicksLength;138 139 // creates and add the major ticks140 this.setMajorTicks({141 fixedPrecision: true,142 precision: this.scalePrecision,143 font: this._font,144 offset: this._majorTicksOffset,145 interval: this.majorTicksInterval,146 length: this._majorTicksLength,147 color: this.majorTicksColor,148 labelPlacement: this.majorTicksLabelPlacement149 });150 151 // creates and add the minor ticks152 this.setMinorTicks({153 offset: this._minorTicksOffset,154 interval: this.minorTicksInterval,155 length: this._minorTicksLength,156 color: this.minorTicksColor157 });158 159 // creates and adds the needle160 this._needle = new GlossyCircularGaugeNeedle({161 hideValue: true,162 title: this.title,163 noChange: this.noChange,164 color: this.needleColor,165 value: this.value166 });167 this.addIndicator(this._needle);168 169 // creates and add the text indicator170 this._textIndicator = new TextIndicator({171 x: scale * this._designTextIndicatorX + (this.width - scale * this._designWidth) / 2,172 y: scale * this._designTextIndicatorY + (this.height - scale * this._designHeight) / 2,173 fixedPrecision: true,174 precision: this.textIndicatorPrecision,175 color: this.textIndicatorColor,176 value: this.value ? this.value : this.min,177 align: "middle",178 font: this._textIndicatorFont179 });180 181 if (this.textIndicatorVisible){182 this.addIndicator(this._textIndicator);183 this._textIndicatorAdded = true;184 }185 186 // connect needle and text187 connect.connect(this._needle, "valueChanged", lang.hitch(this, function(){188 this.value = this._needle.value;189 this._textIndicator.update(this._needle.value);190 this.onValueChanged();191 }));192 193 },194 195 196 onValueChanged: function(){197 // summary:198 // Invoked when the value of the gauge has changed.199 200 },201 202 //*******************************************************************************************203 //* Property getters and setters204 //*******************************************************************************************205 206 _setColorAttr: function(color){207 // summary:208 // Sets the main color of the gauge209 // color: String210 // The color211 this.color = color ? color : 'black';212 if (this._gaugeBackground && this._gaugeBackground.parent) 213 this._gaugeBackground.parent.remove(this._gaugeBackground);214 if (this._foreground && this._foreground.parent) 215 this._foreground.parent.remove(this._foreground);216 this._gaugeBackground = null;217 this._foreground = null;218 this.draw();219 },220 221 _setNeedleColorAttr: function(color){222 // summary:223 // Sets the main color of the needle224 // color: String225 // The color226 this.needleColor = color;227 if (this._needle){228 this.removeIndicator(this._needle);229 this._needle.color = this.needleColor;230 this._needle.shape = null;231 this.addIndicator(this._needle);232 }233 },234 235 _setTextIndicatorColorAttr: function(color){236 // summary:237 // Sets the color of text indicator display the gauge's value238 // color: String239 // The color240 this.textIndicatorColor = color;241 if (this._textIndicator){242 this._textIndicator.color = this.textIndicatorColor;243 this.draw();244 }245 },246 247 _setTextIndicatorFontAttr: function(font){248 // summary:249 // Sets the font of the text indicator250 // font: String251 // An string representing the font such as 'normal normal normal 10pt Helvetica,Arial,sans-serif' 252 //253 254 this.textIndicatorFont = font;255 this._textIndicatorFont = gfx.splitFontString(font);256 if (this._textIndicator){257 this._textIndicator.font = this._textIndicatorFont;258 this.draw();259 }260 },261 262 setMajorTicksOffset: function(offset){263 // summary:264 // Sets the distance from gauge's center to major ticks265 this._majorTicksOffset = offset;266 this._setMajorTicksProperty({267 'offset': this._majorTicksOffset268 });269 return this;270 },271 272 getMajorTicksOffset: function(){273 // summary:274 // Return the distance from gauge's center to major ticks275 return this._majorTicksOffset;276 },277 278 _setMajorTicksIntervalAttr: function(interval){279 // summary:280 // Sets the interval between major ticks281 this.majorTicksInterval = interval;282 this._setMajorTicksProperty({283 'interval': this.majorTicksInterval284 });285 },286 287 setMajorTicksLength: function(length){288 // summary:289 // Sets the size of the major ticks.290 this._majorTicksLength = length;291 this._setMajorTicksProperty({292 'length': this._majorTicksLength293 });294 return this;295 },296 297 getMajorTicksLength: function(){298 // summary:299 // Returns the size of the major ticks.300 return this._majorTicksLength;301 },302 303 _setMajorTicksColorAttr: function(color){304 // summary:305 // Sets the color of the major ticks.306 this.majorTicksColor = color;307 this._setMajorTicksProperty({308 'color': this.majorTicksColor309 });310 },311 312 _setMajorTicksLabelPlacementAttr: function(placement){313 // summary:314 // Sets the placement of labels relatively to major ticks.315 // placement: String316 // 'inside' or 'outside'317 this.majorTicksLabelPlacement = placement;318 this._setMajorTicksProperty({319 'labelPlacement': this.majorTicksLabelPlacement320 });321 },322 323 _setMajorTicksProperty: function(prop){324 if (this.majorTicks){325 lang.mixin(this.majorTicks, prop);326 this.setMajorTicks(this.majorTicks);327 }328 },329 330 setMinorTicksOffset: function(offset){331 // summary:332 // Sets the distance from gauge's center to minor ticks333 this._minorTicksOffset = offset;334 this._setMinorTicksProperty({335 'offset': this._minorTicksOffset336 });337 return this;338 },339 340 getMinorTicksOffset: function(){341 // summary:342 // Returns the distance from gauge's center to minor ticks343 return this._minorTicksOffset;344 },345 346 _setMinorTicksIntervalAttr: function(interval){347 // summary:348 // Sets the interval between minor ticks349 this.minorTicksInterval = interval;350 this._setMinorTicksProperty({351 'interval': this.minorTicksInterval352 });353 },354 355 setMinorTicksLength: function(length){356 // summary:357 // Sets the size of the minor ticks.358 this._minorTicksLength = length;359 this._setMinorTicksProperty({360 'length': this._minorTicksLength361 });362 return this;363 },364 365 getMinorTicksLength: function(){366 // summary:367 // Return the size of the minor ticks.368 return this._minorTicksLength;369 },370 371 _setMinorTicksColorAttr: function(color){372 // summary:373 // Sets the color of the minor ticks.374 this.minorTicksColor = color;375 this._setMinorTicksProperty({376 'color': this.minorTicksColor377 });378 },379 380 _setMinorTicksProperty: function(prop){381 if (this.minorTicks){382 lang.mixin(this.minorTicks, prop);383 this.setMinorTicks(this.minorTicks);384 }385 },386 387 _setMinAttr: function(min){388 this.min = min;389 390 if (this.majorTicks != null) 391 this.setMajorTicks(this.majorTicks);392 if (this.minorTicks != null) 393 this.setMinorTicks(this.minorTicks);394 this.draw();395 this._updateNeedle();396 },397 398 _setMaxAttr: function(max){399 this.max = max;400 401 if (this.majorTicks != null) 402 this.setMajorTicks(this.majorTicks);403 if (this.minorTicks != null) 404 this.setMinorTicks(this.minorTicks);405 this.draw();406 this._updateNeedle();407 },408 409 _setScalePrecisionAttr: function(value){410 // summary:411 // Changes precision of the numbers in the scale of the gauge412 // value: Number413 // The new value414 this.scalePrecision = value;415 this._setMajorTicksProperty({416 'precision': value417 });418 },419 420 _setTextIndicatorPrecisionAttr: function(value){421 // summary:422 // Changes precision of the numbers in the text indicator423 // value: Number424 // The new value425 this.textIndicatorPrecision = value;426 this._setMajorTicksProperty({427 'precision': value428 });429 },430 431 _setValueAttr: function(value){432 // summary:433 // Changes the value of the gauge434 // value: Number435 // The new value for the gauge. 436 437 value = Math.min(this.max, value);438 value = Math.max(this.min, value);439 this.value = value;440 if (this._needle){441 // update will not work if noChange is true.442 var noChange = this._needle.noChange;443 this._needle.noChange = false;444 this._needle.update(value);445 this._needle.noChange = noChange;446 }447 },448 449 _setNoChangeAttr: function(value){450 // summary:451 // Indicates if the value of the gauge can be changed or not452 // value: boolean453 // true indicates that the gauge's value cannot be changed 454 this.noChange = value;455 if (this._needle) 456 this._needle.noChange = this.noChange;457 },458 459 _setTextIndicatorVisibleAttr: function(value){460 // summary:461 // Changes the visibility of the text indicator displaying the gauge's value.462 // value: boolean463 // true to show the indicator, false to hide.464 465 this.textIndicatorVisible = value;466 if (this._textIndicator && this._needle){467 if (this.textIndicatorVisible && !this._textIndicatorAdded){468 this.addIndicator(this._textIndicator);469 this._textIndicatorAdded = true;470 this.moveIndicatorToFront(this._needle);471 472 }473 else 474 if (!this.textIndicatorVisible && this._textIndicatorAdded){475 this.removeIndicator(this._textIndicator);476 this._textIndicatorAdded = false;477 }478 }479 },480 481 _setTitleAttr: function(value){482 // summary:483 // Sets the title displayed by the needle's tooltip .484 // value: String485 // the title486 487 this.title = value;488 if (this._needle){489 this._needle.title = this.title;490 }491 },492 493 _setOrientationAttr: function(orientation){494 // summary:495 // Sets the orientation of the gauge496 // orientation: String497 // Either "clockwise" or "cclockwise" 498 499 this.orientation = orientation;500 if (this.majorTicks != null) 501 this.setMajorTicks(this.majorTicks);502 if (this.minorTicks != null) 503 this.setMinorTicks(this.minorTicks);504 this.draw();505 this._updateNeedle();506 507 },508 509 _updateNeedle: function(){510 // updates the needle with no animation 511 this.value = Math.max(this.min, this.value);512 this.value = Math.min(this.max, this.value);513 514 if (this._needle){515 // update will not work if noChange is true.516 var noChange = this._needle.noChange;517 this._needle.noChange = false;518 this._needle.update(this.value, false);519 this._needle.noChange = noChange;520 } // to redraw the needle521 },522 523 _setFontAttr: function(font){524 // summary:525 // Sets the font of the gauge526 // font: String527 // An string representing the font such as 'normal normal normal 10pt Helvetica,Arial,sans-serif'528 529 this.font = font;530 this._font = gfx.splitFontString(font);531 this._setMajorTicksProperty({532 'font': this._font533 });534 }});...
GlossyCircularGaugeBase.js.consoleStripped.js
Source:GlossyCircularGaugeBase.js.consoleStripped.js
1define("dojox/gauges/GlossyCircularGaugeBase", ["dojo/_base/declare","dojo/_base/lang","dojo/_base/connect","dojox/gfx","./AnalogGauge","./AnalogCircleIndicator","./TextIndicator","./GlossyCircularGaugeNeedle"],2function(declare, lang, connect, gfx, AnalogGauge, AnalogCircleIndicator, TextIndicator, GlossyCircularGaugeNeedle) {3return declare("dojox.gauges.GlossyCircularGaugeBase", [AnalogGauge], {4 // summary:5 // The base class for GlossyCircularGauge and GlossySemiCircularGauge.6 7 8 //_defaultIndicator : _Indicator9 // the type of default indicator to create10 _defaultIndicator: AnalogCircleIndicator,11 12 // _needle: dojox.gauges.GlossyCircularGaugeNeedle13 // the needle of this circular gauge14 _needle: null,15 16 // _textIndicator: dojox.gauges.TextIndicator17 // the text displaying the gauge's value18 _textIndicator: null,19 20 _textIndicatorAdded: false,21 22 // _range: Object23 // the range of this gauge24 _range: null,25 26 // value: Number27 // The value of the gauge.28 value: 0,29 30 // color: String31 // The main color of the gauge.32 color: 'black',33 34 // needleColor: Color35 // The main color of the needle.36 needleColor: '#c4c4c4',37 38 // textIndicatorFont: String39 // The font of the text indicator40 textIndicatorFont: "normal normal normal 20pt serif",41 42 // textIndicatorVisible: Boolean43 // Indicates if the text indicator is visible44 textIndicatorVisible: true,45 46 // textIndicatorColor: Color47 // The color of the text indicator48 textIndicatorColor: '#c4c4c4',49 50 // _majorTicksOffset: Number51 // Distance, at design, from gauge's center to major ticks52 _majorTicksOffset: 130,53 54 // majorTicksInterval: Number55 // Interval between major ticks56 majorTicksInterval: 10,57 58 // _majorTicksLength: Number59 // Major tick size, at design60 _majorTicksLength: 5,61 62 // majorTicksColor: Color63 // Color of major tick marks64 majorTicksColor: '#c4c4c4',65 66 // majorTicksLabelPlacement: String67 // Placement of major tick labels68 majorTicksLabelPlacement: 'inside',69 70 // _minorTicksOffset: Number71 // Distance, at design, from gauge's center to minor ticks72 _minorTicksOffset: 130,73 74 // minorTicksInterval: Number75 // Interval between minor ticks76 minorTicksInterval: 5,77 78 // _minorTicksLength: Number79 // Minor tick size, at design80 _minorTicksLength: 3,81 82 // minorTicksColor: Color83 // Color of minor tick marks84 minorTicksColor: '#c4c4c4',85 86 // noChange: Boolean87 // Indicates if the gauge reacts to touch events88 noChange: false,89 90 // title: String91 // The title displayed in the needle's tooltip92 title: "",93 94 // font: Object95 // The font of the gauge96 font: "normal normal normal 10pt serif",97 98 // scalePrecision: Number99 // The precision for the formatting of numbers in the scale (default is 0)100 scalePrecision: 0,101 102 // textIndicatorPrecision: Number103 // The precision for the formatting of numbers in the text indicator (default is 0)104 textIndicatorPrecision: 0,105 106 _font: null,107 108 109 constructor: function(){110 this.startAngle = -135;111 this.endAngle = 135;112 this.min = 0;113 this.max = 100;114 },115 116 startup: function(){117 // summary:118 // Overrides AnalogGauge.startup119 this.inherited(arguments);120 121 //just in case someone calls the startup twice.122 if (this._needle) return; 123 124 var scale = Math.min((this.width / this._designWidth), (this.height / this._designHeight));125 this.cx = scale * this._designCx + (this.width - scale * this._designWidth) / 2;126 this.cy = scale * this._designCy + (this.height - scale * this._designHeight) / 2;127 128 this._range = {129 low: this.min ? this.min : 0,130 high: this.max ? this.max : 100,131 color: [255, 255, 255, 0]132 };133 this.addRange(this._range);134 135 this._majorTicksOffset = this._minorTicksOffset = scale * this._majorTicksOffset;136 this._majorTicksLength = scale * this._majorTicksLength;137 this._minorTicksLength = scale * this._minorTicksLength;138 139 // creates and add the major ticks140 this.setMajorTicks({141 fixedPrecision: true,142 precision: this.scalePrecision,143 font: this._font,144 offset: this._majorTicksOffset,145 interval: this.majorTicksInterval,146 length: this._majorTicksLength,147 color: this.majorTicksColor,148 labelPlacement: this.majorTicksLabelPlacement149 });150 151 // creates and add the minor ticks152 this.setMinorTicks({153 offset: this._minorTicksOffset,154 interval: this.minorTicksInterval,155 length: this._minorTicksLength,156 color: this.minorTicksColor157 });158 159 // creates and adds the needle160 this._needle = new GlossyCircularGaugeNeedle({161 hideValue: true,162 title: this.title,163 noChange: this.noChange,164 color: this.needleColor,165 value: this.value166 });167 this.addIndicator(this._needle);168 169 // creates and add the text indicator170 this._textIndicator = new TextIndicator({171 x: scale * this._designTextIndicatorX + (this.width - scale * this._designWidth) / 2,172 y: scale * this._designTextIndicatorY + (this.height - scale * this._designHeight) / 2,173 fixedPrecision: true,174 precision: this.textIndicatorPrecision,175 color: this.textIndicatorColor,176 value: this.value ? this.value : this.min,177 align: "middle",178 font: this._textIndicatorFont179 });180 181 if (this.textIndicatorVisible){182 this.addIndicator(this._textIndicator);183 this._textIndicatorAdded = true;184 }185 186 // connect needle and text187 connect.connect(this._needle, "valueChanged", lang.hitch(this, function(){188 this.value = this._needle.value;189 this._textIndicator.update(this._needle.value);190 this.onValueChanged();191 }));192 193 },194 195 196 onValueChanged: function(){197 // summary:198 // Invoked when the value of the gauge has changed.199 200 },201 202 //*******************************************************************************************203 //* Property getters and setters204 //*******************************************************************************************205 206 _setColorAttr: function(color){207 // summary:208 // Sets the main color of the gauge209 // color: String210 // The color211 this.color = color ? color : 'black';212 if (this._gaugeBackground && this._gaugeBackground.parent) 213 this._gaugeBackground.parent.remove(this._gaugeBackground);214 if (this._foreground && this._foreground.parent) 215 this._foreground.parent.remove(this._foreground);216 this._gaugeBackground = null;217 this._foreground = null;218 this.draw();219 },220 221 _setNeedleColorAttr: function(color){222 // summary:223 // Sets the main color of the needle224 // color: String225 // The color226 this.needleColor = color;227 if (this._needle){228 this.removeIndicator(this._needle);229 this._needle.color = this.needleColor;230 this._needle.shape = null;231 this.addIndicator(this._needle);232 }233 },234 235 _setTextIndicatorColorAttr: function(color){236 // summary:237 // Sets the color of text indicator display the gauge's value238 // color: String239 // The color240 this.textIndicatorColor = color;241 if (this._textIndicator){242 this._textIndicator.color = this.textIndicatorColor;243 this.draw();244 }245 },246 247 _setTextIndicatorFontAttr: function(font){248 // summary:249 // Sets the font of the text indicator250 // font: String251 // An string representing the font such as 'normal normal normal 10pt Helvetica,Arial,sans-serif' 252 //253 254 this.textIndicatorFont = font;255 this._textIndicatorFont = gfx.splitFontString(font);256 if (this._textIndicator){257 this._textIndicator.font = this._textIndicatorFont;258 this.draw();259 }260 },261 262 setMajorTicksOffset: function(offset){263 // summary:264 // Sets the distance from gauge's center to major ticks265 this._majorTicksOffset = offset;266 this._setMajorTicksProperty({267 'offset': this._majorTicksOffset268 });269 return this;270 },271 272 getMajorTicksOffset: function(){273 // summary:274 // Return the distance from gauge's center to major ticks275 return this._majorTicksOffset;276 },277 278 _setMajorTicksIntervalAttr: function(interval){279 // summary:280 // Sets the interval between major ticks281 this.majorTicksInterval = interval;282 this._setMajorTicksProperty({283 'interval': this.majorTicksInterval284 });285 },286 287 setMajorTicksLength: function(length){288 // summary:289 // Sets the size of the major ticks.290 this._majorTicksLength = length;291 this._setMajorTicksProperty({292 'length': this._majorTicksLength293 });294 return this;295 },296 297 getMajorTicksLength: function(){298 // summary:299 // Returns the size of the major ticks.300 return this._majorTicksLength;301 },302 303 _setMajorTicksColorAttr: function(color){304 // summary:305 // Sets the color of the major ticks.306 this.majorTicksColor = color;307 this._setMajorTicksProperty({308 'color': this.majorTicksColor309 });310 },311 312 _setMajorTicksLabelPlacementAttr: function(placement){313 // summary:314 // Sets the placement of labels relatively to major ticks.315 // placement: String316 // 'inside' or 'outside'317 this.majorTicksLabelPlacement = placement;318 this._setMajorTicksProperty({319 'labelPlacement': this.majorTicksLabelPlacement320 });321 },322 323 _setMajorTicksProperty: function(prop){324 if (this.majorTicks){325 lang.mixin(this.majorTicks, prop);326 this.setMajorTicks(this.majorTicks);327 }328 },329 330 setMinorTicksOffset: function(offset){331 // summary:332 // Sets the distance from gauge's center to minor ticks333 this._minorTicksOffset = offset;334 this._setMinorTicksProperty({335 'offset': this._minorTicksOffset336 });337 return this;338 },339 340 getMinorTicksOffset: function(){341 // summary:342 // Returns the distance from gauge's center to minor ticks343 return this._minorTicksOffset;344 },345 346 _setMinorTicksIntervalAttr: function(interval){347 // summary:348 // Sets the interval between minor ticks349 this.minorTicksInterval = interval;350 this._setMinorTicksProperty({351 'interval': this.minorTicksInterval352 });353 },354 355 setMinorTicksLength: function(length){356 // summary:357 // Sets the size of the minor ticks.358 this._minorTicksLength = length;359 this._setMinorTicksProperty({360 'length': this._minorTicksLength361 });362 return this;363 },364 365 getMinorTicksLength: function(){366 // summary:367 // Return the size of the minor ticks.368 return this._minorTicksLength;369 },370 371 _setMinorTicksColorAttr: function(color){372 // summary:373 // Sets the color of the minor ticks.374 this.minorTicksColor = color;375 this._setMinorTicksProperty({376 'color': this.minorTicksColor377 });378 },379 380 _setMinorTicksProperty: function(prop){381 if (this.minorTicks){382 lang.mixin(this.minorTicks, prop);383 this.setMinorTicks(this.minorTicks);384 }385 },386 387 _setMinAttr: function(min){388 this.min = min;389 390 if (this.majorTicks != null) 391 this.setMajorTicks(this.majorTicks);392 if (this.minorTicks != null) 393 this.setMinorTicks(this.minorTicks);394 this.draw();395 this._updateNeedle();396 },397 398 _setMaxAttr: function(max){399 this.max = max;400 401 if (this.majorTicks != null) 402 this.setMajorTicks(this.majorTicks);403 if (this.minorTicks != null) 404 this.setMinorTicks(this.minorTicks);405 this.draw();406 this._updateNeedle();407 },408 409 _setScalePrecisionAttr: function(value){410 // summary:411 // Changes precision of the numbers in the scale of the gauge412 // value: Number413 // The new value414 this.scalePrecision = value;415 this._setMajorTicksProperty({416 'precision': value417 });418 },419 420 _setTextIndicatorPrecisionAttr: function(value){421 // summary:422 // Changes precision of the numbers in the text indicator423 // value: Number424 // The new value425 this.textIndicatorPrecision = value;426 this._setMajorTicksProperty({427 'precision': value428 });429 },430 431 _setValueAttr: function(value){432 // summary:433 // Changes the value of the gauge434 // value: Number435 // The new value for the gauge. 436 437 value = Math.min(this.max, value);438 value = Math.max(this.min, value);439 this.value = value;440 if (this._needle){441 // update will not work if noChange is true.442 var noChange = this._needle.noChange;443 this._needle.noChange = false;444 this._needle.update(value);445 this._needle.noChange = noChange;446 }447 },448 449 _setNoChangeAttr: function(value){450 // summary:451 // Indicates if the value of the gauge can be changed or not452 // value: boolean453 // true indicates that the gauge's value cannot be changed 454 this.noChange = value;455 if (this._needle) 456 this._needle.noChange = this.noChange;457 },458 459 _setTextIndicatorVisibleAttr: function(value){460 // summary:461 // Changes the visibility of the text indicator displaying the gauge's value.462 // value: boolean463 // true to show the indicator, false to hide.464 465 this.textIndicatorVisible = value;466 if (this._textIndicator && this._needle){467 if (this.textIndicatorVisible && !this._textIndicatorAdded){468 this.addIndicator(this._textIndicator);469 this._textIndicatorAdded = true;470 this.moveIndicatorToFront(this._needle);471 472 }473 else 474 if (!this.textIndicatorVisible && this._textIndicatorAdded){475 this.removeIndicator(this._textIndicator);476 this._textIndicatorAdded = false;477 }478 }479 },480 481 _setTitleAttr: function(value){482 // summary:483 // Sets the title displayed by the needle's tooltip .484 // value: String485 // the title486 487 this.title = value;488 if (this._needle){489 this._needle.title = this.title;490 }491 },492 493 _setOrientationAttr: function(orientation){494 // summary:495 // Sets the orientation of the gauge496 // orientation: String497 // Either "clockwise" or "cclockwise" 498 499 this.orientation = orientation;500 if (this.majorTicks != null) 501 this.setMajorTicks(this.majorTicks);502 if (this.minorTicks != null) 503 this.setMinorTicks(this.minorTicks);504 this.draw();505 this._updateNeedle();506 507 },508 509 _updateNeedle: function(){510 // updates the needle with no animation 511 this.value = Math.max(this.min, this.value);512 this.value = Math.min(this.max, this.value);513 514 if (this._needle){515 // update will not work if noChange is true.516 var noChange = this._needle.noChange;517 this._needle.noChange = false;518 this._needle.update(this.value, false);519 this._needle.noChange = noChange;520 } // to redraw the needle521 },522 523 _setFontAttr: function(font){524 // summary:525 // Sets the font of the gauge526 // font: String527 // An string representing the font such as 'normal normal normal 10pt Helvetica,Arial,sans-serif'528 529 this.font = font;530 this._font = gfx.splitFontString(font);531 this._setMajorTicksProperty({532 'font': this._font533 });534 }});...
SoundSource_Envelope.ts
Source:SoundSource_Envelope.ts
1namespace ThisCouldBeBetter.MusicTracker2{3export class SoundSource_Envelope extends SoundSourceChild4{5 ticksPerSecond: number;6 attackDurationInTicks: number;7 decayDurationInTicks: number;8 sustainDurationInTicks: number;9 sustainAmplitudeMultiplier: number;10 releaseDurationInTicks: number;11 child: SoundSource;12 inputAttackDurationInTicks: any;13 inputDecayDurationInTicks: any;14 inputReleaseDurationInTicks: any15 inputSustainAmplitudeMultiplier: any;16 inputSustainDurationInTicks: any;17 inputTicksPerSecond: any;18 constructor19 (20 ticksPerSecond: number,21 attackDurationInTicks: number,22 decayDurationInTicks: number,23 sustainDurationInTicks: number,24 sustainAmplitudeMultiplier: number,25 releaseDurationInTicks: number,26 child: SoundSource27 )28 {29 super(SoundSourceType.Instances().Envelope.name);30 this.ticksPerSecond = ticksPerSecond;31 this.attackDurationInTicks = attackDurationInTicks;32 this.decayDurationInTicks = decayDurationInTicks;33 this.sustainDurationInTicks = sustainDurationInTicks;34 this.sustainAmplitudeMultiplier = sustainAmplitudeMultiplier;35 this.releaseDurationInTicks = releaseDurationInTicks;36 this.child = child;37 }38 static default(): SoundSource_Envelope39 {40 return new SoundSource_Envelope41 (42 1000, // ticksPerSecond43 100, // attackDurationInTicks44 200, // decayDurationInTicks45 500, // sustainDurationInTicks46 .5, // sustainAmplitudeMultiplier47 200, // releaseDurationInTicks48 new SoundSource(new SoundSource_Silence())49 );50 }51 sampleForFrequencyAndTime52 (53 frequencyInHertz: number, timeInSeconds: number54 ): number55 {56 var amplitudeMultiplier;57 var timeInTicks = timeInSeconds * this.ticksPerSecond;58 if (timeInTicks < this.attackDurationInTicks)59 {60 amplitudeMultiplier = timeInTicks / this.attackDurationInTicks;61 }62 else63 {64 timeInTicks -= this.attackDurationInTicks;65 if (timeInTicks < this.decayDurationInTicks)66 {67 var decayProgress = timeInTicks / this.decayDurationInTicks;68 var decayAmplitudeChange = 1 - this.sustainAmplitudeMultiplier;69 amplitudeMultiplier =70 this.sustainAmplitudeMultiplier71 + decayAmplitudeChange * (1 - decayProgress);72 }73 else74 {75 timeInTicks -= this.decayDurationInTicks;76 if (timeInTicks < this.sustainDurationInTicks)77 {78 amplitudeMultiplier = this.sustainAmplitudeMultiplier;79 }80 else81 {82 timeInTicks -= this.sustainDurationInTicks;83 if (timeInTicks < this.releaseDurationInTicks)84 {85 var releaseProgress = timeInTicks / this.releaseDurationInTicks;86 amplitudeMultiplier =87 this.sustainAmplitudeMultiplier88 * (1 - releaseProgress)89 }90 else91 {92 amplitudeMultiplier = 0;93 }94 }95 }96 }97 var sampleFromChild =98 this.child.sampleForFrequencyAndTime(frequencyInHertz, timeInSeconds);99 var returnValue = sampleFromChild * amplitudeMultiplier;100 return returnValue;101 }102 // ui103 uiClear(): void104 {105 delete this.divSoundSource;106 delete this.inputAttackDurationInTicks;107 delete this.inputDecayDurationInTicks;108 delete this.inputSustainDurationInTicks;109 delete this.inputSustainAmplitudeMultiplier;110 delete this.inputReleaseDurationInTicks;111 this.child.uiClear();112 }113 uiUpdate(): void114 {115 var soundSource = this;116 var d = document;117 if (this.divSoundSource == null)118 {119 this.divSoundSource = d.createElement("div");120 var labelTicksPerSecond = d.createElement("label");121 labelTicksPerSecond.innerText = "Ticks per Second:";122 this.divSoundSource.appendChild(labelTicksPerSecond);123 var inputTicksPerSecond = d.createElement("input");124 inputTicksPerSecond.type = "number";125 inputTicksPerSecond.style.width = "64px";126 inputTicksPerSecond.onchange = (event: any) =>127 {128 soundSource.ticksPerSecond = parseInt(inputTicksPerSecond.value);129 }130 this.divSoundSource.appendChild(inputTicksPerSecond);131 this.divSoundSource.appendChild(d.createElement("br"));132 this.inputTicksPerSecond = inputTicksPerSecond;133 var labelAttackDurationInTicks = d.createElement("label");134 labelAttackDurationInTicks.innerText = "Attack Duration in Ticks:";135 this.divSoundSource.appendChild(labelAttackDurationInTicks);136 var inputAttackDurationInTicks = d.createElement("input");137 inputAttackDurationInTicks.type = "number";138 inputAttackDurationInTicks.style.width = "64px";139 inputAttackDurationInTicks.onchange = (event: any) =>140 {141 soundSource.attackDurationInTicks = parseInt(inputAttackDurationInTicks.value);142 }143 this.divSoundSource.appendChild(inputAttackDurationInTicks);144 this.divSoundSource.appendChild(d.createElement("br"));145 this.inputAttackDurationInTicks = inputAttackDurationInTicks;146 var labelDecayDurationInTicks = d.createElement("label");147 labelDecayDurationInTicks.innerText = "Decay Duration in Ticks:";148 this.divSoundSource.appendChild(labelDecayDurationInTicks);149 var inputDecayDurationInTicks = d.createElement("input");150 inputDecayDurationInTicks.type = "number";151 inputDecayDurationInTicks.style.width = "64px";152 inputDecayDurationInTicks.onchange = (event: any) =>153 {154 soundSource.decayDurationInTicks = parseInt(inputDecayDurationInTicks.value);155 }156 this.divSoundSource.appendChild(inputDecayDurationInTicks);157 this.divSoundSource.appendChild(d.createElement("br"));158 this.inputDecayDurationInTicks = inputDecayDurationInTicks;159 var labelSustainDurationInTicks = d.createElement("label");160 labelSustainDurationInTicks.innerText = "Sustain Duration in Ticks:";161 this.divSoundSource.appendChild(labelSustainDurationInTicks);162 var inputSustainDurationInTicks = d.createElement("input");163 inputSustainDurationInTicks.type = "number";164 inputSustainDurationInTicks.style.width = "64px";165 inputSustainDurationInTicks.onchange = (event: any) =>166 {167 soundSource.sustainDurationInTicks = parseInt(inputSustainDurationInTicks.value);168 }169 this.divSoundSource.appendChild(inputSustainDurationInTicks);170 this.divSoundSource.appendChild(d.createElement("br"));171 this.inputSustainDurationInTicks = inputSustainDurationInTicks;172 var labelSustainAmplitudeMultiplier = d.createElement("label");173 labelSustainAmplitudeMultiplier.innerText = "Sustain Amplitude Multiplier:";174 this.divSoundSource.appendChild(labelSustainAmplitudeMultiplier);175 var inputSustainAmplitudeMultiplier = d.createElement("input");176 inputSustainAmplitudeMultiplier.type = "number";177 inputSustainAmplitudeMultiplier.style.width = "64px";178 inputSustainAmplitudeMultiplier.onchange = (event: any) =>179 {180 soundSource.sustainAmplitudeMultiplier =181 parseFloat(inputSustainAmplitudeMultiplier.value);182 }183 this.divSoundSource.appendChild(inputSustainAmplitudeMultiplier);184 this.divSoundSource.appendChild(d.createElement("br"));185 this.inputSustainAmplitudeMultiplier = inputSustainAmplitudeMultiplier;186 var labelReleaseDurationInTicks = d.createElement("label");187 labelReleaseDurationInTicks.innerText = "Release Duration in Ticks:";188 this.divSoundSource.appendChild(labelReleaseDurationInTicks);189 var inputReleaseDurationInTicks = d.createElement("input");190 inputReleaseDurationInTicks.type = "number";191 inputReleaseDurationInTicks.style.width = "64px";192 inputReleaseDurationInTicks.onchange = (event: any) =>193 {194 soundSource.releaseDurationInTicks =195 parseInt(inputReleaseDurationInTicks.value);196 }197 this.divSoundSource.appendChild(inputReleaseDurationInTicks);198 this.divSoundSource.appendChild(d.createElement("br"));199 this.inputReleaseDurationInTicks = inputReleaseDurationInTicks;200 var labelChild = d.createElement("label");201 labelChild.innerText = "Child:";202 this.divSoundSource.appendChild(labelChild);203 var divChild = d.createElement("div");204 this.divSoundSource.appendChild(divChild);205 this.divChild = divChild;206 var childAsDiv = this.child.uiUpdate();207 this.divChild.appendChild(childAsDiv);208 }209 else210 {211 this.inputTicksPerSecond.value = this.ticksPerSecond;212 this.inputAttackDurationInTicks.value = this.attackDurationInTicks;213 this.inputDecayDurationInTicks.value = this.decayDurationInTicks;214 this.inputSustainDurationInTicks.value = this.sustainDurationInTicks;215 this.inputSustainAmplitudeMultiplier.value = this.sustainAmplitudeMultiplier;216 this.inputReleaseDurationInTicks.value = this.releaseDurationInTicks;217 this.child.uiUpdate();218 }219 return this.divSoundSource;220 }221}...
Using AI Code Generation
1const strykerParent = require('stryker-parent');2strykerParent.ticks();3const strykerParent = require('stryker-parent');4strykerParent.ticks();5const strykerParent = require('stryker-parent');6strykerParent.ticks();7const strykerParent = require('stryker-parent');8strykerParent.ticks();9const strykerParent = require('stryker-parent');10strykerParent.ticks();11const strykerParent = require('stryker-parent');12strykerParent.ticks();13const strykerParent = require('stryker-parent');14strykerParent.ticks();15const strykerParent = require('stryker-parent');16strykerParent.ticks();17const strykerParent = require('stryker-parent');18strykerParent.ticks();19const strykerParent = require('stryker-parent');20strykerParent.ticks();21const strykerParent = require('stryker-parent');22strykerParent.ticks();23const strykerParent = require('stryker-parent');24strykerParent.ticks();25const strykerParent = require('stryker-parent');26strykerParent.ticks();27const strykerParent = require('stryker-parent');28strykerParent.ticks();
Using AI Code Generation
1module.exports = function (config) {2 config.set({3 karma: {4 config: {5 }6 }7 });8};9module.exports = function (config) {10 config.set({11 karma: {12 config: {13 }14 }15 });16};17module.exports = function (config) {18 config.set({19 karma: {20 config: {21 }22 }23 });24};25module.exports = function (config) {26 config.set({27 karma: {28 config: {
Using AI Code Generation
1const ticks = require('stryker-parent').ticks;2ticks();3const ticks = require('stryker-parent').ticks;4ticks();5module.exports = {6 ticks: function() {7 return 1;8 }9};10module.exports = {11 ticks: function() {12 return 1;13 }14};15{16}17{18}19[*.{js,py}]20# Tab indentation (no size specified)21[{package.json,.travis.yml}]
Using AI Code Generation
1var strykerParent = require('stryker-parent');2strykerParent.ticks(function (ticks) {3});4var strykerParent = require('stryker-parent');5strykerParent.ticks(function (ticks) {6});7var strykerParent = require('stryker-parent');8strykerParent.ticks(function (ticks) {9});10var strykerParent = require('stryker-parent');11strykerParent.ticks(function (ticks) {12});13var strykerParent = require('stryker-parent');14strykerParent.ticks(function (ticks) {15});16var strykerParent = require('stryker-parent');17strykerParent.ticks(function (ticks) {18});19var strykerParent = require('stryker-parent');20strykerParent.ticks(function (ticks) {21});22var strykerParent = require('stryker-parent');23strykerParent.ticks(function (ticks) {24});25var strykerParent = require('stryker-parent');26strykerParent.ticks(function (ticks) {27});28var strykerParent = require('stryker-parent');29strykerParent.ticks(function (ticks) {30});31var strykerParent = require('stryker-parent');32strykerParent.ticks(function (
Using AI Code Generation
1const { ticks } = require("stryker-parent");2const { ticks } = require("stryker-parent");3const { ticks } = require("stryker-parent");4const { ticks } = require("stryker-parent");5const { ticks } = require("stryker-parent");6const { ticks } = require("stryker-parent");7const { ticks } = require("stryker-parent");8const { ticks } = require("stryker-parent");9const { ticks } = require("stryker-parent");10const { ticks } = require("stryker-parent");11const { ticks } = require("stryker-parent");12const { ticks } = require("stryker-parent");13const { ticks } = require("stryker-parent");14const { ticks } = require("stryker-parent");
Using AI Code Generation
1const strykerParent = require('stryker-parent');2const ticks = strykerParent.ticks;3console.log(ticks('Hello World'));4module.exports = function(config) {5 config.set({6 });7};8In this example, the ticks method is imported from stryker-parent and then used to mutate the string Hello World . The result of this mutation is:9const strykerParent = require('stryker-parent');10const ticks = strykerParent.ticks;11console.log(ticks('Hello World'));12module.exports = function(config) {13 config.set({14 });15};16module.exports = function(config) {17 config.set({18 });19};20const strykerParent = require('stryker-parent');21const ticks = strykerParent.ticks;22console.log(ticks('Hello World'));23module.exports = function(config) {24 config.set({25 });26};
Using AI Code Generation
1var ticks = require('stryker-parent').ticks;2ticks.addTickListener(function() {3 console.log('tick');4});5ticks.startTicking(1000);6var ticks = require('stryker-parent').ticks;7ticks.addTickListener(function() {8 console.log('tick');9});10ticks.startTicking(1000);11var ticks = require('stryker-parent').ticks;12ticks.addTickListener(function() {13 console.log('tick');14});15ticks.startTicking(1000);16var ticks = require('stryker-parent').ticks;17ticks.addTickListener(function() {18 console.log('tick');19});20ticks.startTicking(1000);21var ticks = require('stryker-parent').ticks;22ticks.addTickListener(function() {23 console.log('tick');24});25ticks.startTicking(1000);26var ticks = require('stryker-parent').ticks;27ticks.addTickListener(function() {28 console.log('tick');29});30ticks.startTicking(1000);31var ticks = require('stryker-parent').ticks;32ticks.addTickListener(function() {33 console.log('tick');34});35ticks.startTicking(1000);36var ticks = require('stryker-parent').ticks;37ticks.addTickListener(function() {38 console.log('tick');39});40ticks.startTicking(1000);41var ticks = require('stryker-parent').ticks;42ticks.addTickListener(function() {43 console.log('tick');44});45ticks.startTicking(1000);46var ticks = require('stryker-parent').ticks;47ticks.addTickListener(function() {48 console.log('tick');49});50ticks.startTicking(1000);
Using AI Code Generation
1var stryker = require('stryker-parent');2var ticks = stryker.ticks;3var test = function() {4 ticks.start();5 ticks.stop();6 ticks.report();7}8test();9The ticks.report() method can be used in two ways:10The ticks.report() method can be used to report the number of ticks that were executed during the execution of the code under test, in two ways:11The ticks.report() method can be used to report the number of ticks that were executed during the execution of the code under test, in two ways:12The ticks.report() method can be used to report the number of ticks that were executed during the execution of the code under test, in two
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!