diff options
author | Nivesh Rajbhandari | 2012-06-04 17:11:06 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-06-04 17:12:36 -0700 |
commit | d44f3196c925332dcaf45f7cf8c64e22a1994bb9 (patch) | |
tree | 770ac0df9b73ee8fad584bfd1708ed2866910c92 /js/mediators | |
parent | c1ec69879028220b0c3f11ad6e24035bf527802c (diff) | |
download | ninja-d44f3196c925332dcaf45f7cf8c64e22a1994bb9.tar.gz |
Fill and Ink-Bottle fixes.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/mediators')
-rwxr-xr-x | js/mediators/element-mediator.js | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index 1d5e9ade..7244b58e 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js | |||
@@ -389,7 +389,6 @@ exports.ElementMediator = Montage.create(Component, { | |||
389 | @param eventType: Change/Changing. Will be passed to the dispatched event | 389 | @param eventType: Change/Changing. Will be passed to the dispatched event |
390 | @param source: String for the source object making the call | 390 | @param source: String for the source object making the call |
391 | @param currentValue *OPTIONAL*: current value array. If not found the current value is calculated | 391 | @param currentValue *OPTIONAL*: current value array. If not found the current value is calculated |
392 | @param stageRedraw: *OPTIONAL*: True. If set to false the stage will not redraw the selection/outline | ||
393 | */ | 392 | */ |
394 | setStroke: { | 393 | setStroke: { |
395 | value: function(els, value, eventType, source, currentValue) { | 394 | value: function(els, value, eventType, source, currentValue) { |
@@ -448,6 +447,44 @@ exports.ElementMediator = Montage.create(Component, { | |||
448 | } | 447 | } |
449 | }, | 448 | }, |
450 | 449 | ||
450 | getFill: { | ||
451 | value: function(el, fillProperties) { | ||
452 | return el.elementModel.controller["getFill"](el, fillProperties); | ||
453 | } | ||
454 | }, | ||
455 | |||
456 | |||
457 | /** | ||
458 | Set a property change command for an element or array of elements | ||
459 | @param els: Array of elements. Can contain 1 or more elements | ||
460 | @param value: Value to be set. This is the fill info | ||
461 | @param eventType: Change/Changing. Will be passed to the dispatched event | ||
462 | @param source: String for the source object making the call | ||
463 | @param currentValue *OPTIONAL*: current value array. If not found the current value is calculated | ||
464 | */ | ||
465 | setFill: { | ||
466 | value: function(els, value, eventType, source, currentValue) { | ||
467 | |||
468 | if(eventType !== "Changing") { | ||
469 | // Calculate currentValue if not found for each element | ||
470 | if(!currentValue) { | ||
471 | var that = this, | ||
472 | val = value; | ||
473 | currentValue = els.map(function(item) { | ||
474 | return that.getFill(item, val); | ||
475 | }); | ||
476 | } | ||
477 | document.application.undoManager.add("Set fill", this.setFill, this, els, currentValue, eventType, source, value); | ||
478 | } | ||
479 | |||
480 | for(var i=0, item; item = els[i]; i++) { | ||
481 | item.elementModel.controller["setFill"](item, (value[i] || value), eventType, source); | ||
482 | } | ||
483 | |||
484 | NJevent("element" + eventType, {type : "setFill", source: source, data: {"els": els, "prop": "fill", "value": value}, redraw: null}); | ||
485 | } | ||
486 | }, | ||
487 | |||
451 | //-------------------------------------------------------------------------------------------------------- | 488 | //-------------------------------------------------------------------------------------------------------- |
452 | // Routines to get/set 3D properties | 489 | // Routines to get/set 3D properties |
453 | get3DProperty: { | 490 | get3DProperty: { |