model.js.orig 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // ******* Object Model ******** //
  2. $axure.internal(function($ax) {
  3. var _implementations = {};
  4. var _initializeObject = function(type, obj) {
  5. $.extend(obj, _implementations[type]);
  6. };
  7. $ax.initializeObject = _initializeObject;
  8. var _model = $ax.model = {};
  9. _model.idsInRdo = function(rdoId, elementIds) {
  10. var rdoScriptId = $ax.repeater.getScriptIdFromElementId(rdoId);
  11. var rdoObj = $obj(rdoId);
  12. var path = $ax.getPathFromScriptId(rdoScriptId);
  13. var rdoRepeater = $ax.getParentRepeaterFromScriptId(rdoScriptId);
  14. var rdoItem = $ax.repeater.getItemIdFromElementId(rdoId);
  15. if(!elementIds) elementIds = [];
  16. $ax('*').each(function(obj, elementId) {
  17. // Make sure in same rdo
  18. var scriptId = $ax.repeater.getScriptIdFromElementId(elementId);
  19. var elementPath = $ax.getPathFromScriptId(scriptId);
  20. // This is because last part of path is for the obj itself.
  21. elementPath.pop();
  22. if(elementPath.length != path.length) return;
  23. for(var i = 0; i < path.length; i++) if(elementPath[i] != path[i]) return;
  24. // If object is in a panel, the panel will be hidden, so the obj doesn't have to be.
  25. if(obj.parentDynamicPanel) return;
  26. var repeater = $ax.getParentRepeaterFromScriptId(scriptId);
  27. var item = $ax.repeater.getItemIdFromElementId(elementId);
  28. if(repeater != rdoRepeater || item != rdoItem) return;
  29. if(obj.type == 'referenceDiagramObject') _model.idsInRdo(elementId, elementIds);
  30. else elementIds.push(elementId);
  31. });
  32. return elementIds;
  33. };
  34. });