产品原型
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.9 KiB

4 years ago
  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.idsInRdoToHideOrLimbo = function(rdoId, scriptIds) {
  10. var rdoScriptId = $ax.repeater.getScriptIdFromElementId(rdoId);
  11. var path = $ax.getPathFromScriptId(rdoScriptId);
  12. if(!scriptIds) scriptIds = [];
  13. var rdo = $ax.getObjectFromElementId(rdoId);
  14. var master = $ax.pageData.masters[rdo.masterId];
  15. var masterChildren = master.diagram.objects;
  16. for(var i = 0; i < masterChildren.length; i++) {
  17. var obj = masterChildren[i];
  18. var objScriptIds = obj.scriptIds;
  19. for(var j = 0; j < objScriptIds.length; j++) {
  20. var scriptId = objScriptIds[j];
  21. // Anything in a layer is already handled by the layer
  22. if($ax.getLayerParentFromElementId(scriptId)) continue;
  23. // Make sure in same rdo
  24. var elementPath = $ax.getPathFromScriptId(scriptId);
  25. // This is because last part of path is for the obj itself.
  26. elementPath.pop();
  27. if(elementPath.length != path.length) continue;
  28. var samePath = true;
  29. for(var k = 0; k < path.length; k++) {
  30. if(elementPath[k] != path[k]) {
  31. samePath = false;
  32. break;
  33. }
  34. }
  35. if(!samePath) continue;
  36. if($ax.public.fn.IsReferenceDiagramObject(obj.type)) _model.idsInRdoToHideOrLimbo(scriptId, scriptIds);
  37. else if(scriptIds.indexOf(scriptId) == -1) scriptIds.push(scriptId);
  38. break;
  39. }
  40. }
  41. return scriptIds;
  42. };
  43. });