Skip to content

Commit d717c5c

Browse files
committed
Removed final traces of _interactive properties and checks. Also added preUpdate catch.
1 parent ed3afed commit d717c5c

4 files changed

Lines changed: 36 additions & 197 deletions

File tree

src/pixi/display/DisplayObject.js

Lines changed: 9 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,6 @@ PIXI.DisplayObject = function()
130130
*/
131131
this.worldAlpha = 1;
132132

133-
/**
134-
* [read-only] Whether or not the object is interactive, do not toggle directly! use the `interactive` property
135-
*
136-
* @property _interactive
137-
* @type Boolean
138-
* @readOnly
139-
* @private
140-
*/
141-
this._interactive = false;
142-
143133
/**
144134
* This is the cursor that will be used when the mouse is over this object. To enable this the element must have interaction = true and buttonMode = true
145135
*
@@ -231,131 +221,11 @@ PIXI.DisplayObject = function()
231221
*/
232222
this._cacheIsDirty = false;
233223

234-
235-
/*
236-
* MOUSE Callbacks
237-
*/
238-
239-
/**
240-
* A callback that is used when the users mouse rolls over the displayObject
241-
* @method mouseover
242-
* @param interactionData {InteractionData}
243-
*/
244-
245-
/**
246-
* A callback that is used when the users mouse leaves the displayObject
247-
* @method mouseout
248-
* @param interactionData {InteractionData}
249-
*/
250-
251-
//Left button
252-
/**
253-
* A callback that is used when the users clicks on the displayObject with their mouse's left button
254-
* @method click
255-
* @param interactionData {InteractionData}
256-
*/
257-
258-
/**
259-
* A callback that is used when the user clicks the mouse's left button down over the sprite
260-
* @method mousedown
261-
* @param interactionData {InteractionData}
262-
*/
263-
264-
/**
265-
* A callback that is used when the user releases the mouse's left button that was over the displayObject
266-
* for this callback to be fired, the mouse's left button must have been pressed down over the displayObject
267-
* @method mouseup
268-
* @param interactionData {InteractionData}
269-
*/
270-
271-
/**
272-
* A callback that is used when the user releases the mouse's left button that was over the displayObject but is no longer over the displayObject
273-
* for this callback to be fired, the mouse's left button must have been pressed down over the displayObject
274-
* @method mouseupoutside
275-
* @param interactionData {InteractionData}
276-
*/
277-
278-
//Right button
279-
/**
280-
* A callback that is used when the users clicks on the displayObject with their mouse's right button
281-
* @method rightclick
282-
* @param interactionData {InteractionData}
283-
*/
284-
285-
/**
286-
* A callback that is used when the user clicks the mouse's right button down over the sprite
287-
* @method rightdown
288-
* @param interactionData {InteractionData}
289-
*/
290-
291-
/**
292-
* A callback that is used when the user releases the mouse's right button that was over the displayObject
293-
* for this callback to be fired the mouse's right button must have been pressed down over the displayObject
294-
* @method rightup
295-
* @param interactionData {InteractionData}
296-
*/
297-
298-
/**
299-
* A callback that is used when the user releases the mouse's right button that was over the displayObject but is no longer over the displayObject
300-
* for this callback to be fired, the mouse's right button must have been pressed down over the displayObject
301-
* @method rightupoutside
302-
* @param interactionData {InteractionData}
303-
*/
304-
305-
/*
306-
* TOUCH Callbacks
307-
*/
308-
309-
/**
310-
* A callback that is used when the users taps on the sprite with their finger
311-
* basically a touch version of click
312-
* @method tap
313-
* @param interactionData {InteractionData}
314-
*/
315-
316-
/**
317-
* A callback that is used when the user touches over the displayObject
318-
* @method touchstart
319-
* @param interactionData {InteractionData}
320-
*/
321-
322-
/**
323-
* A callback that is used when the user releases a touch over the displayObject
324-
* @method touchend
325-
* @param interactionData {InteractionData}
326-
*/
327-
328-
/**
329-
* A callback that is used when the user releases the touch that was over the displayObject
330-
* for this callback to be fired, The touch must have started over the sprite
331-
* @method touchendoutside
332-
* @param interactionData {InteractionData}
333-
*/
334224
};
335225

336226
// constructor
337227
PIXI.DisplayObject.prototype.constructor = PIXI.DisplayObject;
338228

339-
/**
340-
* Indicates if the sprite will have touch and mouse interactivity. It is false by default
341-
*
342-
* @property interactive
343-
* @type Boolean
344-
* @default false
345-
*/
346-
Object.defineProperty(PIXI.DisplayObject.prototype, 'interactive', {
347-
get: function() {
348-
return this._interactive;
349-
},
350-
set: function(value) {
351-
this._interactive = value;
352-
353-
// TODO more to be done here..
354-
// need to sort out a re-crawl!
355-
if(this.stage)this.stage.dirty = true;
356-
}
357-
});
358-
359229
/**
360230
* [read-only] Indicates if the sprite is globally visible.
361231
*
@@ -578,7 +448,15 @@ PIXI.DisplayObject.prototype.getLocalBounds = function()
578448
PIXI.DisplayObject.prototype.setStageReference = function(stage)
579449
{
580450
this.stage = stage;
581-
if(this._interactive)this.stage.dirty = true;
451+
};
452+
453+
/**
454+
* Empty, to be overridden by classes that require it.
455+
*
456+
* @method preUpdate
457+
*/
458+
PIXI.DisplayObject.prototype.preUpdate = function()
459+
{
582460
};
583461

584462
/**

src/pixi/display/DisplayObjectContainer.js

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,10 @@ PIXI.DisplayObjectContainer.prototype.getLocalBounds = function()
392392
PIXI.DisplayObjectContainer.prototype.setStageReference = function(stage)
393393
{
394394
this.stage = stage;
395-
if(this._interactive)this.stage.dirty = true;
396-
397-
for(var i=0,j=this.children.length; i<j; i++)
395+
396+
for (var i=0; i < this.children.length; i++)
398397
{
399-
var child = this.children[i];
400-
child.setStageReference(stage);
398+
this.children[i].setStageReference(stage)
401399
}
402400
};
403401

@@ -408,15 +406,11 @@ PIXI.DisplayObjectContainer.prototype.setStageReference = function(stage)
408406
*/
409407
PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
410408
{
411-
412-
for(var i=0,j=this.children.length; i<j; i++)
409+
for (var i = 0; i < this.children.length; i++)
413410
{
414-
var child = this.children[i];
415-
child.removeStageReference();
411+
this.children[i].removeStageReference();
416412
}
417413

418-
if(this._interactive)this.stage.dirty = true;
419-
420414
this.stage = null;
421415
};
422416

@@ -429,50 +423,49 @@ PIXI.DisplayObjectContainer.prototype.removeStageReference = function()
429423
*/
430424
PIXI.DisplayObjectContainer.prototype._renderWebGL = function(renderSession)
431425
{
432-
if(!this.visible || this.alpha <= 0)return;
426+
if (!this.visible || this.alpha <= 0) return;
433427

434-
if(this._cacheAsBitmap)
428+
if (this._cacheAsBitmap)
435429
{
436430
this._renderCachedSprite(renderSession);
437431
return;
438432
}
439433

440-
var i,j;
434+
var i;
441435

442-
if(this._mask || this._filters)
436+
if (this._mask || this._filters)
443437
{
444-
445438
// push filter first as we need to ensure the stencil buffer is correct for any masking
446-
if(this._filters)
439+
if (this._filters)
447440
{
448441
renderSession.spriteBatch.flush();
449442
renderSession.filterManager.pushFilter(this._filterBlock);
450443
}
451444

452-
if(this._mask)
445+
if (this._mask)
453446
{
454447
renderSession.spriteBatch.stop();
455448
renderSession.maskManager.pushMask(this.mask, renderSession);
456449
renderSession.spriteBatch.start();
457450
}
458451

459452
// simple render children!
460-
for(i=0,j=this.children.length; i<j; i++)
453+
for (i = 0; i < this.children.length; i++)
461454
{
462455
this.children[i]._renderWebGL(renderSession);
463456
}
464457

465458
renderSession.spriteBatch.stop();
466459

467-
if(this._mask)renderSession.maskManager.popMask(this._mask, renderSession);
468-
if(this._filters)renderSession.filterManager.popFilter();
460+
if (this._mask) renderSession.maskManager.popMask(this._mask, renderSession);
461+
if (this._filters) renderSession.filterManager.popFilter();
469462

470463
renderSession.spriteBatch.start();
471464
}
472465
else
473466
{
474467
// simple render children!
475-
for(i=0,j=this.children.length; i<j; i++)
468+
for (i = 0; i < this.children.length; i++)
476469
{
477470
this.children[i]._renderWebGL(renderSession);
478471
}
@@ -488,27 +481,25 @@ PIXI.DisplayObjectContainer.prototype._renderWebGL = function(renderSession)
488481
*/
489482
PIXI.DisplayObjectContainer.prototype._renderCanvas = function(renderSession)
490483
{
491-
if(this.visible === false || this.alpha === 0)return;
484+
if (this.visible === false || this.alpha === 0) return;
492485

493-
if(this._cacheAsBitmap)
486+
if (this._cacheAsBitmap)
494487
{
495-
496488
this._renderCachedSprite(renderSession);
497489
return;
498490
}
499491

500-
if(this._mask)
492+
if (this._mask)
501493
{
502494
renderSession.maskManager.pushMask(this._mask, renderSession);
503495
}
504496

505-
for(var i=0,j=this.children.length; i<j; i++)
497+
for (i = 0; i < this.children.length; i++)
506498
{
507-
var child = this.children[i];
508-
child._renderCanvas(renderSession);
499+
this.children[i]._renderCanvas(renderSession);
509500
}
510501

511-
if(this._mask)
502+
if (this._mask)
512503
{
513504
renderSession.maskManager.popMask(renderSession);
514505
}

src/pixi/renderers/canvas/CanvasRenderer.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ PIXI.CanvasRenderer.prototype.render = function(stage)
197197
this.renderSession.currentBlendMode = PIXI.blendModes.NORMAL;
198198
this.context.globalCompositeOperation = PIXI.blendModesCanvas[PIXI.blendModes.NORMAL];
199199

200-
if (navigator.isCocoonJS && this.view.screencanvas) {
200+
if (navigator.isCocoonJS && this.view.screencanvas)
201+
{
201202
this.context.fillStyle = "black";
202203
this.context.clear();
203204
}
@@ -217,16 +218,6 @@ PIXI.CanvasRenderer.prototype.render = function(stage)
217218

218219
this.renderDisplayObject(stage);
219220

220-
// run interaction!
221-
if(stage.interactive)
222-
{
223-
//need to add some events!
224-
if(!stage._interactiveEventsAdded)
225-
{
226-
stage._interactiveEventsAdded = true;
227-
stage.interactionManager.setTarget(this);
228-
}
229-
}
230221
};
231222

232223
/**

src/pixi/renderers/webgl/WebGLRenderer.js

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,11 @@ PIXI.WebGLRenderer.prototype.initContext = function()
281281
PIXI.WebGLRenderer.prototype.render = function(stage)
282282
{
283283
// no point rendering if our context has been blown up!
284-
if(this.contextLost)return;
284+
if (this.contextLost) return;
285285

286286
// if rendering a new stage clear the batches..
287-
if(this.__stage !== stage)
287+
if (this.__stage !== stage)
288288
{
289-
if(stage.interactive)stage.interactionManager.removeEvents();
290-
291289
// TODO make this work
292290
// dont think this is needed any more?
293291
this.__stage = stage;
@@ -298,34 +296,15 @@ PIXI.WebGLRenderer.prototype.render = function(stage)
298296

299297
var gl = this.gl;
300298

301-
// interaction
302-
if(stage._interactive)
303-
{
304-
//need to add some events!
305-
if(!stage._interactiveEventsAdded)
306-
{
307-
stage._interactiveEventsAdded = true;
308-
stage.interactionManager.setTarget(this);
309-
}
310-
}
311-
else
312-
{
313-
if(stage._interactiveEventsAdded)
314-
{
315-
stage._interactiveEventsAdded = false;
316-
stage.interactionManager.setTarget(this);
317-
}
318-
}
319-
320299
// -- Does this need to be set every frame? -- //
321300
gl.viewport(0, 0, this.width, this.height);
322301

323302
// make sure we are bound to the main frame buffer
324303
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
325304

326305
if (this.clearBeforeRender)
327-
{
328-
if(this.transparent)
306+
{
307+
if (this.transparent)
329308
{
330309
gl.clearColor(0, 0, 0, 0);
331310
}

0 commit comments

Comments
 (0)