Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: polymer_1.0.4/bower_components/iron-resizable-behavior/demo/src/x-app.html

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!--
2 @license
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
9 -->
10
11 <link rel="import" href="../../iron-resizable-behavior.html">
12
13 <dom-module id="x-puck">
14
15 <style>
16
17 :host {
18 display: inline-block;
19 border: 3px solid lightblue;
20 }
21
22 </style>
23
24 <template>
25
26 <b>I'm a resize-aware, thirdifying puck at (<span>{{x}}</span> x <span>{{y}} </span>).</b>
27
28 </template>
29
30 </dom-module>
31
32 <script>
33
34 Polymer({
35
36 is: 'x-puck',
37
38 behaviors: [
39 Polymer.IronResizableBehavior
40 ],
41
42 properties: {
43 x: {
44 type: Number,
45 value: 0
46 },
47
48 y: {
49 type: Number,
50 value: 0
51 }
52 },
53
54 listeners: {
55 'iron-resize': '_onIronResize'
56 },
57
58 attached: function() {
59 this.async(this.notifyResize, 1);
60 },
61
62 get parent() {
63 if (this.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
64 return this.parentNode.host;
65 }
66
67 return this.parentNode;
68 },
69
70 _onIronResize: function() {
71 var x = this.x = Math.floor(this.parent.offsetWidth / 3);
72 var y = this.y = Math.floor(this.parent.offsetHeight / 3);
73
74 this.translate3d(x + 'px', y + 'px', 0);
75 }
76 });
77
78 </script>
79
80 <dom-module id="x-app">
81
82 <style>
83
84 :host {
85 display: block;
86 position: absolute;
87 top: 0;
88 right: 0;
89 bottom: 0;
90 left: 0;
91 }
92
93 </style>
94
95 <template>
96
97 <x-puck></x-puck>
98
99 </template>
100
101 </dom-module>
102
103 <script>
104
105 Polymer({
106
107 is: 'x-app',
108
109 behaviors: [
110 Polymer.IronResizableBehavior
111 ]
112 });
113
114 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698