node/lib/metasm/metasm/gui/dasm_graph.rb
def group_remove_hz_margin(g, maxw=16)
		if g.content.empty?
			g.x = -maxw/2 if g.x < -maxw/2
			g.w = maxw if g.w > maxw
			return
		end

		margin_left = g.content.map { |b| b.x }.min - g.x
		margin_right = g.x+g.w - g.content.map { |b| b.x+b.w }.max
		if margin_left + margin_right > maxw
			g.w -= margin_left + margin_right - maxw
			dx = (maxw/2 + margin_right - margin_left)/2
			g.content.each { |b| b.x += dx }
			g.x = -g.w/2
		end
	end
# if a group has no content close to its x/x+w borders, shrink it
if a group has no content close to its x/x+w borders, shrink it
if a group has no content close to its x / x + w borders shrink it
def group_remove_hz_margin(g, maxw=16)
		if g.content.empty?
			g.x = -maxw/2 if g.x < -maxw/2
			g.w = maxw if g.w > maxw
			return
		end
		margin_left = g.content.map { |b| b.x }.min - g.x
		margin_right = g.x+g.w - g.content.map { |b| b.x+b.w }.max
		if margin_left + margin_right > maxw
			g.w -= margin_left + margin_right - maxw
			dx = (maxw/2 + margin_right - margin_left)/2
			g.content.each { |b| b.x += dx }
			g.x = -g.w/2
		end
	end
def group_remove_hz_margin ( g , maxw = 16 ) if g . content . empty? g . x = - maxw / 2 if g . x < - maxw / 2 g . w = maxw if g . w > maxw return end margin_left = g . content . map { | b | b . x } . min - g . x margin_right = g . x + g . w - g . content . map { | b | b . x + b . w } . max if margin_left + margin_right > maxw g . w -= margin_left + margin_right - maxw dx = ( maxw / 2 + margin_right - margin_left ) / 2 g . content . each { | b | b . x += dx } g . x = - g . w / 2 end end
if a group has no content close to its x/x+w borders, shrink it
if a group has no content close to its x / x + w borders shrink it
g
maxw