Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

fix(mdDialog): if targetEvent element is hidden when dialog closes, shrink to the element's original position #3555

Closed
wants to merge 3 commits into from
Closed

Conversation

dozingcat
Copy link
Contributor

No description provided.

dozingcat added 3 commits July 2, 2015 11:27
…hrink to the element's original position

Previously the dialog would always shrink to the upper left if the targetEvent element was no longer visible when the dialog closed. Also add tests to verify that the correct CSS transforms are set when expanding and shrinking.
…hrink to the element's original position

Previously the dialog would always shrink to the upper left if the targetEvent element was no longer visible when the dialog closed. Also add tests to verify that the correct CSS transforms are set when expanding and shrinking.
…hrink to the element's original position

Previously the dialog would always shrink to the upper left if the targetEvent element was no longer visible when the dialog closed. Also add tests to verify that the correct CSS transforms are set when expanding and shrinking.
@dozingcat
Copy link
Contributor Author

This is a fix for #3541

@dozingcat dozingcat changed the title Mddialog targetevent fix branch fix(mdDialog): if targetEvent element is hidden when dialog closes, shrink to the element's original position Jul 3, 2015
@ThomasBurleson ThomasBurleson added this to the 0.10.1 milestone Jul 3, 2015
@ThomasBurleson
Copy link
Contributor

@dozingcat - can you provide a unit test case or a CodePen to validate these changes?

@dozingcat
Copy link
Contributor Author

The codepen at http://codepen.io/anon/pen/BNYpEZ shows the current behavior. This is the local file I used to confirm the new behavior:

<html>
<head>
<link rel="stylesheet" href="../material/dist/angular-material.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.1/angular-aria.min.js"></script>
<script src="../material/dist/angular-material.js"></script>
<style>
    .menu {
      background: lightblue;  
    }
    .menu-contents {
      display: none;
      padding: 10px;
    }
    .menu:hover .menu-contents {
      display: block;
    }
    md-dialog {
      padding: 20px;
    }
</style>
<script>
  angular
    .module('demoApp', ['ngMaterial'])
    .controller("DemoController", function($scope, $mdDialog) {
        $scope.showDialog = function(e) {
          $mdDialog.show({
            template: "<md-dialog>Event: " + e + "</md-dialog>",
            clickOutsideToClose: true,
            targetEvent: e
          })
        };
    }
  );
</script>
</head>
<body>
<div ng-app="demoApp" 
     ng-controller="DemoController"
     style="float:right; padding: 20px;">
  <md-button ng-click="showDialog($event)">Open dialog</md-button>
  <p></p>
  <div class="menu">
    Menu
    <div class="menu-contents">
      <a ng-click="showDialog($event)">Open from menu</a>
    </div>
  </div>
</div>
</body>
</html>

@ThomasBurleson
Copy link
Contributor

@dozingcat - that was helpful; and the demo helps me understand a usage scenario.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants