Blame view

controllets/animated-button-container-controllet/animated-button-container-controllet.html 4.7 KB
f748e9cf   Luigi Serra   new controllet an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
  

  <link rel="import" href="../../bower_components/polymer/polymer.html">

  <link rel="import" href="../../bower_components/paper-styles/paper-styles.html">

  <link rel="import" href="../../bower_components/iron-icons/iron-icons.html">

  <link rel="import" href="../../bower_components/paper-fab/paper-fab.html">

  <link rel="import" href="../../bower_components/paper-material/paper-material.html">

  <link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">

  <link rel="import" href="../../bower_components/neon-animation/neon-animated-pages.html">

  <link rel="import" href="../../bower_components/neon-animation/neon-animations.html">

  

  <link rel="import" href="../../controllets/items-list-controllet/item-list-controllet.html">

  

  <dom-module id="animated-button-container-controllet">

  

      <style>

  

          :host {

          @apply(--layout-horizontal);

          @apply(--layout-center-center);

          }

          #pages{

              position: absolute;

              top: -38px;

              left: 113px;

          }

  

          .window {

              width: 30vw;

              height: 50vh;

              background: #e8e8e8;

              position: absolute;

              top: 64px;

              left: 0px;

              z-index: 1000;

          }

  

          .hidden{

              display: none;

          }

  

          #close{

              position: absolute;

              top: -14px;

              left: 28.5vw;

              --iron-icon-height: 24px;

              --iron-icon-width: 24px;

              width: 32px;

              height: 32px;

              --paper-fab-background:#2196f3;

              z-index: 1001;

          }

  

          #open{

              --iron-icon-height: 48px;

              --iron-icon-width: 48px;

              width: 64px;

              height: 64px;

              --paper-fab-background:#2196f3;

          }

  

          #selected_item{

              margin-left: 25px;

              padding: 0;

              ms-transform: scale(0.60);

              -moz-transform: scale(0.60);

              -o-transform: scale(0.60);

              -webkit-transform: scale(0.60);

              transform: scale(0.60);

              -ms-transform-origin: 0 0;

              -moz-transform-origin: 0 0;

              -o-transform-origin: 0 0;

              -webkit-transform-origin: 0 0;

              transform-origin: 0 0;"

          }

  

          #container_content{

              z-index: 1000;

          }

  

      </style>

  

      <template>

          <neon-animated-pages id="pages" selected="[[selected]]" entry-animation="[[entryAnimation]]" exit-animation="[[exitAnimation]]">

              <neon-animatable><div id="hidden"></div></neon-animatable>

              <neon-animatable>

                  <paper-material elevation="3" id="window" class="window">

                     <paper-fab id="close" mini icon="close" on-click="_onCloseClick"></paper-fab>

                     <div id="container_content"><content></content></div>

                  </paper-material>

              </neon-animatable>

          </neon-animated-pages>

  

          <div class="horizontal layout" style="height: 64px;">

             <paper-fab mini icon="assessment" id="open" on-click="_onOpenClick"></paper-fab>

             <div id="selected_item">

             </div>

          </div>

  

      </template>

  

  </dom-module>

  

  <script>

  

      Polymer({

  

          is: 'animated-button-container-controllet',

  

          listeners:{

              'items-list-controllet_item-selected' : '_elementSelected'

          },

  

          properties: {

              selected : {

                  type  : Number,

                  value : 0

              },

              height:{

                  type: String,

                  value: "30vh"

              },

              width:{

                  type: String,

                  value: "30vh"

              },

              entryAnimation : {

                  type  : String,

                  value : ""

              },

  

              exitAnimation  : {

                  type  : String,

                  value : ""

              }

          },

  

          ready: function(){

              this.$.window.style.height = this.height;

              this.$.window.style.width  = this.width;

          },

  

          _onOpenClick: function() {

              this.entryAnimation = 'fade-in-animation';

              this.exitAnimation  = 'fade-out-animation';

              this.selected = 1;

          },

  

          _onCloseClick: function(){

              /*this.entryAnimation = 'fade-out-animation';

              this.exitAnimation  = 'fade-in-animation';*/

              this.selected = 0;

          },

  

          _elementSelected: function(e){

              this.$.selected_item.innerHTML = "";

              this.$.selected_item.appendChild(e.detail.selectedElement);

          }

  

      });

  

  </script>